Check if unserialization failed.
authorJan Schneider <jan@horde.org>
Mon, 23 Aug 2010 13:07:41 +0000 (15:07 +0200)
committerJan Schneider <jan@horde.org>
Mon, 23 Aug 2010 13:07:41 +0000 (15:07 +0200)
turba/lib/Turba.php

index fc53c6b..63faa61 100644 (file)
@@ -587,7 +587,7 @@ class Turba {
         /* Add the new addressbook to the user's list of visible address
          * books. */
         $prefs = json_decode($GLOBALS['prefs']->getValue('addressbooks'));
-        if (array_search($share_id, $prefs) === false) {
+        if (!is_array($prefs) || array_search($share_id, $prefs) === false) {
             $prefs[] = $share_id;
             $GLOBALS['prefs']->setValue('addressbooks', json_encode($prefs));
         }