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 <devenbansod.bits@gmail.com>
This commit is contained in:
Deven Bansod 2016-08-25 23:59:29 +05:30
parent 96f5f101cc
commit b3e7f10f2e

View File

@ -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'];
}