diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index 30cfc4a52b..8590ed4e63 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -420,7 +420,7 @@ class e_array { * Returns an array from stored array data in php serialized, e107 var_export and json-encoded data. * * @param string $ArrayData - * @return array stored data + * @return array|bool stored data */ public function unserialize($ArrayData) { @@ -461,12 +461,17 @@ public function unserialize($ArrayData) $ArrayData = trim($ArrayData); + if(strpos($ArrayData, "\$data = ") === 0) // Fix for buggy old value. + { + $ArrayData = substr($ArrayData,8); + } + if(strtolower(substr($ArrayData,0,5)) != 'array') { return false; } - if(strpos($ArrayData,"0 => \'")!=false) + if(strpos($ArrayData," => \'") !== false) { $ArrayData = stripslashes($ArrayData); } diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 4ba7eb83ce..f44c30a806 100755 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -1751,17 +1751,17 @@ public static function user($uid=null) * Return a string containg exported array data. - preferred. * * @param array $ArrayData array to be stored - * @param bool $AddSlashes default false, add slashes for db storage, else false - * @return string + * @param bool|string $mode true = var_export with addedslashes, false = var_export (default), 'json' = json encoded + * @return array|string */ - public static function serialize($ArrayData, $AddSlashes = false) + public static function serialize($ArrayData, $mode = false) { if(empty($ArrayData)) { return array(); } - return self::getArrayStorage()->serialize($ArrayData, $AddSlashes); + return self::getArrayStorage()->serialize($ArrayData, $mode); } /**