From efc2e629537c6e51f8336645083ec14d029ad28e Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 25 Mar 2016 11:24:07 -0700 Subject: [PATCH] NewForumPosts could fail under some circumstances. Extra checks added for e107::unserialize(); --- e107_handlers/core_functions.php | 8 ++++++++ e107_handlers/media_class.php | 8 +++++++- e107_plugins/forum/newforumposts_menu.php | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/e107_handlers/core_functions.php b/e107_handlers/core_functions.php index bbbc08932..0f201f81e 100644 --- a/e107_handlers/core_functions.php +++ b/e107_handlers/core_functions.php @@ -450,6 +450,14 @@ class e_array { $ArrayData = str_replace('=>','=>',$ArrayData); //FIX for PDO encoding of strings. . + if(trim($ArrayData) == 'Array') // Something went wrong with storage. + { + $debug = debug_backtrace(false); + e107::getMessage()->addDebug("Bad Array Storage found: ". print_a($debug,true)); + + return array(); + } + $data = ""; $ArrayData = '$data = '.$ArrayData.';'; diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 4b1138d39..8987fbf13 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -946,8 +946,14 @@ class e_media { $icons[] = $prefix.substr($match[1],3); } - + + if(empty($icons)) // failed to produce a result so don't cache it. . + { + return array(); + } + $data = e107::serialize($icons); + $cache->set($type,$data,true); return $icons; diff --git a/e107_plugins/forum/newforumposts_menu.php b/e107_plugins/forum/newforumposts_menu.php index 0b3227432..d71a4dc6a 100755 --- a/e107_plugins/forum/newforumposts_menu.php +++ b/e107_plugins/forum/newforumposts_menu.php @@ -139,9 +139,9 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php) } - if(isset($this->menuPref['caption'])) + if(!empty($this->menuPref['caption'])) { - $caption = varset($this->menuPref['caption'][e_LANGUAGE], $this->menuPref['caption']); + $caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption']; } else {