JSON encode prefs scope object when serializing.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 24 Nov 2010 21:44:16 +0000 (14:44 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 25 Nov 2010 03:43:29 +0000 (20:43 -0700)
Another advantage of requiring UTF-8 input to prefs - JSON encoding
provides ~12% storage advantage (in my limited testing) over serialize().

framework/Prefs/lib/Horde/Prefs/Scope.php

index 0bf1c27..8a9359f 100644 (file)
@@ -255,7 +255,7 @@ class Horde_Prefs_Scope implements Serializable
      */
     public function serialize()
     {
-        return serialize(array(
+        return json_encode(array(
             $this->scope,
             $this->_prefs
         ));
@@ -265,7 +265,7 @@ class Horde_Prefs_Scope implements Serializable
      */
     public function unserialize($data)
     {
-        list($this->scope, $this->_prefs) = unserialize($data);
+        list($this->scope, $this->_prefs) = json_decode($data, true);
     }
 
 }