From b3e7f10f2ed8949512b623cac4055de86fe368fc Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Thu, 25 Aug 2016 23:59:29 +0530 Subject: [PATCH] Check if the indices are present and map to a string value Fix #12477 The indices may not be present in the json_decode result, or might not be strings Signed-off-by: Deven Bansod --- libraries/common.inc.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libraries/common.inc.php b/libraries/common.inc.php index 9ec0fc32cd..3c6134afcf 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -455,9 +455,15 @@ PMA_setGlobalDbOrTable('table'); */ if (PMA_isValid($_REQUEST['selected_recent_table'])) { $recent_table = json_decode($_REQUEST['selected_recent_table'], true); - $GLOBALS['db'] = $recent_table['db']; + + $GLOBALS['db'] + = (array_key_exists('db', $recent_table) && is_string($recent_table['db'])) ? + $recent_table['db'] : ''; $GLOBALS['url_params']['db'] = $GLOBALS['db']; - $GLOBALS['table'] = $recent_table['table']; + + $GLOBALS['table'] + = (array_key_exists('table', $recent_table) && is_string($recent_table['table'])) ? + $recent_table['table'] : ''; $GLOBALS['url_params']['table'] = $GLOBALS['table']; }