From 85eedd0c115a208fec278fb0bb0f63dfd53a5b1d Mon Sep 17 00:00:00 2001 From: uwetews Date: Mon, 1 Feb 2016 00:46:15 +0100 Subject: [PATCH] - bugfix {foreach} compilation failed when $smarty->merge_compiled_includes = true and pre-filters are used. https://github.com/smarty-php/smarty/issues/172 --- change_log.txt | 3 +++ .../smarty_internal_compile_private_foreachsection.php | 2 +- libs/sysplugins/smarty_internal_extension_handler.php | 9 +++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/change_log.txt b/change_log.txt index cf4869bb..223c59fc 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@  ===== 3.1.30-dev ===== (xx.xx.xx) + 01.02.2016 + - bugfix {foreach} compilation failed when $smarty->merge_compiled_includes = true and pre-filters are used. + 29.01.2016 - bugfix implement replacement code for _tag_stack property https://github.com/smarty-php/smarty/issues/151 diff --git a/libs/sysplugins/smarty_internal_compile_private_foreachsection.php b/libs/sysplugins/smarty_internal_compile_private_foreachsection.php index 16f23335..4c5dfd8f 100644 --- a/libs/sysplugins/smarty_internal_compile_private_foreachsection.php +++ b/libs/sysplugins/smarty_internal_compile_private_foreachsection.php @@ -175,7 +175,7 @@ class Smarty_Internal_Compile_Private_ForeachSection extends Smarty_Internal_Com // run pre filter if required if ((isset($nextCompiler->smarty->autoload_filters['pre']) || isset($nextCompiler->smarty->registered_filters['pre']))) { - $_content = $nextCompiler->smarty->ext->_filter_Handler->runFilter('pre', $_content, $nextCompiler->template); + $_content = $nextCompiler->smarty->ext->_filterHandler->runFilter('pre', $_content, $nextCompiler->template); } $this->matchProperty($_content); } diff --git a/libs/sysplugins/smarty_internal_extension_handler.php b/libs/sysplugins/smarty_internal_extension_handler.php index 94fc81a6..65fd4bdb 100644 --- a/libs/sysplugins/smarty_internal_extension_handler.php +++ b/libs/sysplugins/smarty_internal_extension_handler.php @@ -123,15 +123,12 @@ class Smarty_Internal_Extension_Handler public function __get($property_name) { // object properties of runtime template extensions will start with '_' - if ($property_name[0] == '_') { + if ($property_name[ 0 ] == '_') { $class = 'Smarty_Internal_Runtime_' . ucfirst(substr($property_name, 1)); } else { $class = 'Smarty_Internal_Method_' . ucfirst($property_name); } - if (class_exists($class)) { - return $this->$property_name = new $class(); - } - return $this; + return $this->$property_name = new $class(); } /** @@ -145,7 +142,7 @@ class Smarty_Internal_Extension_Handler */ public function __call($name, $args) { - return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), $args); + return call_user_func_array(array(new Smarty_Internal_Undefined(), $name), array($this)); } } \ No newline at end of file