Handle unserialize() failures gracefully
authorChuck Hagenbuch <chuck@horde.org>
Fri, 24 Sep 2010 15:22:11 +0000 (11:22 -0400)
committerChuck Hagenbuch <chuck@horde.org>
Fri, 24 Sep 2010 15:22:11 +0000 (11:22 -0400)
ansel/lib/Gallery.php

index 4e6f17b..e927431 100644 (file)
@@ -732,7 +732,10 @@ class Ansel_Gallery extends Horde_Share_Object_Sql_Hierarchical
             $style = Ansel::getStyleDefinition($GLOBALS['prefs']->getValue('default_gallerystyle'));
         } else {
             // Explicitly defined style
-            $style = unserialize($this->data['attribute_style']);
+            $style = @unserialize($this->data['attribute_style']);
+            if (!$style) {
+                $style = Ansel::getStyleDefinition($GLOBALS['prefs']->getValue('default_gallerystyle'));
+            }
         }
 
         // Check browser requirements. If we require PNG support, and do not