We need to use serialize() for arrays too, because the serialized data
authorJan Schneider <jan@horde.org>
Thu, 11 Nov 2010 15:51:22 +0000 (16:51 +0100)
committerJan Schneider <jan@horde.org>
Thu, 11 Nov 2010 20:23:59 +0000 (21:23 +0100)
might contain non-utf8 data.

framework/Core/lib/Horde/Session.php

index 2df8591..8ceb715 100644 (file)
@@ -273,18 +273,13 @@ class Horde_Session
          * given page load.  Thus, for arrays and objects, it is beneficial to
          * always convert to string representations so that the object/array
          * does not need to be rebuilt every time the session is reloaded. */
-        if (is_object($value) || ($mask & self::TYPE_OBJECT)) {
+        if (is_object($value) || ($mask & self::TYPE_OBJECT) ||
+            is_array($value) || ($mask & self::TYPE_ARRAY)) {
             $value = serialize($value);
             if ($this->_lzf) {
                 $value = lzf_compress($value);
             }
             $_SESSION[self::SERIALIZED][$key] = 's';
-        } elseif (is_array($value) || ($mask & self::TYPE_ARRAY)) {
-            $value = json_encode($value);
-            if ($this->_lzf) {
-                $value = lzf_compress($value);
-            }
-            $_SESSION[self::SERIALIZED][$key] = 'j';
         } else {
             unset($_SESSION[self::SERIALIZED][$key]);
         }