From 4288d45b08e78b06b001a038348df4df7eb29e9a Mon Sep 17 00:00:00 2001 From: Erik Amaru Ortiz Date: Thu, 20 Mar 2014 12:32:29 -0400 Subject: [PATCH] Fix For PHP 5.4.x compatibility when PMPluginRegstry singleton is loaded from serialized file --- .../engine/classes/class.pluginRegistry.php | 18 ++++++++++++++++++ workflow/public_html/sysGeneric.php | 9 +++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index 1e3f3af87..d51baadc7 100755 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -139,6 +139,24 @@ class PMPluginRegistry return self::$instance; } + /** + * Load the singleton instance from a serialized stored file + * + * @param $file + * @return PMPluginRegistry + * @throws Exception + */ + public static function loadSingleton($file) + { + self::$instance = unserialize(file_get_contents($file)); + + if (! is_object(self::$instance) || get_class(self::$instance) != "PMPluginRegistry") { + throw new Exception("Can't load main PMPluginRegistry object."); + } + + return self::$instance; + } + /** * This function generates a storable representation of a value * param diff --git a/workflow/public_html/sysGeneric.php b/workflow/public_html/sysGeneric.php index 7e7079375..16f5aebab 100755 --- a/workflow/public_html/sysGeneric.php +++ b/workflow/public_html/sysGeneric.php @@ -26,8 +26,8 @@ * bootstrap - ProcessMaker Bootstrap * this file is used initialize main variables, redirect and dispatch all requests */ - - +//session_cache_limiter('none'); +//die('neyek'); function transactionLog($transactionName){ if (extension_loaded('newrelic')) { $baseName="ProcessMaker"; @@ -609,12 +609,13 @@ Bootstrap::LoadClass( 'plugin' ); //here we are loading all plugins registered //the singleton has a list of enabled plugins $sSerializedFile = PATH_DATA_SITE . 'plugin.singleton'; -$oPluginRegistry = & PMPluginRegistry::getSingleton(); if (file_exists( $sSerializedFile )) { - $oPluginRegistry->unSerializeInstance( file_get_contents( $sSerializedFile ) ); + $oPluginRegistry = PMPluginRegistry::loadSingleton($sSerializedFile); $attributes = $oPluginRegistry->getAttributes(); Bootstrap::LoadTranslationPlugins( defined( 'SYS_LANG' ) ? SYS_LANG : "en" , $attributes); +} else{ + $oPluginRegistry = PMPluginRegistry::getSingleton(); } // setup propel definitions and logging