From 0515e1b03ed5dcf055efffb75aa5f42a26969e94 Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Wed, 16 Feb 2011 21:51:53 +0100 Subject: [PATCH] store userprefs using JSON instead of serialized PHP array --- libraries/user_preferences.lib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libraries/user_preferences.lib.php b/libraries/user_preferences.lib.php index bf84b25dc..6c48116d6 100644 --- a/libraries/user_preferences.lib.php +++ b/libraries/user_preferences.lib.php @@ -68,8 +68,9 @@ function PMA_load_userprefs() FROM ' . $query_table . ' WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\''; $row = PMA_DBI_fetch_single_row($query, 'ASSOC', $GLOBALS['controllink']); + return array( - 'config_data' => $row ? unserialize($row['config_data']) : array(), + 'config_data' => $row ? (array)json_decode($row['config_data']) : array(), 'mtime' => $row ? $row['ts'] : time(), 'type' => 'db'); } @@ -122,7 +123,7 @@ function PMA_save_userprefs(array $config_array) WHERE `username` = \'' . PMA_sqlAddslashes($cfgRelation['user']) . '\''; $has_config = PMA_DBI_fetch_value($query, 0, 0, $GLOBALS['controllink']); - $config_data = serialize($config_array); + $config_data = json_encode($config_array); if ($has_config) { $query = ' UPDATE ' . $query_table . '