Use json encoding to save array data (lighter footprint)
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 25 Jun 2009 23:16:02 +0000 (17:16 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 25 Jun 2009 23:27:46 +0000 (17:27 -0600)
imp/lib/Mailbox.php

index 7017404..9205d56 100644 (file)
@@ -100,9 +100,9 @@ class IMP_Mailbox
         if (!is_null($uid)) {
             /* Try to rebuild sorted information from the session cache. */
             if (isset($_SESSION['imp']['cache']['imp_mailbox'][$mailbox])) {
-                $tmp = unserialize($_SESSION['imp']['cache']['imp_mailbox'][$mailbox]);
-                $this->_sorted = $tmp['s'];
-                $this->_sortedInfo = $tmp['i'];
+                $tmp = json_decode($_SESSION['imp']['cache']['imp_mailbox'][$mailbox]);
+                $this->_sorted = $tmp->s;
+                $this->_sortedInfo = $tmp->i;
             }
             $this->setIndex($uid);
         }
@@ -117,7 +117,7 @@ class IMP_Mailbox
     public function __destruct()
     {
         if (!is_null($this->_arrayIndex)) {
-            $_SESSION['imp']['cache']['imp_mailbox'][$this->_mailbox] = serialize(array('i' => $this->_sortedInfo, 's' => $this->_sorted));
+            $_SESSION['imp']['cache']['imp_mailbox'][$this->_mailbox] = json_encode(array('i' => $this->_sortedInfo, 's' => $this->_sorted));
         }
     }