diff --git a/change_log.txt b/change_log.txt index 1ca9a5f6..b1480b6f 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,7 +2,8 @@ 13.07.2016 - bugfix PHP 7 compatibility on registered compiler plugins https://github.com/smarty-php/smarty/issues/241 - update testInstall() https://github.com/smarty-php/smarty/issues/248https://github.com/smarty-php/smarty/issues/248 - + - bugfix enable debugging could fail when template objects did already exists https://github.com/smarty-php/smarty/issues/237 + 12.07.2016 - bugfix {foreach} item variable must be created also on empty from array https://github.com/smarty-php/smarty/issues/238 and https://github.com/smarty-php/smarty/issues/239 - bugfix enableSecurity() must init cache flags https://github.com/smarty-php/smarty/issues/247 diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 4b2f3855..904ecd7d 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.30-dev/76'; + const SMARTY_VERSION = '3.1.30-dev/77'; /** * define variable scopes diff --git a/libs/sysplugins/smarty_internal_config_file_compiler.php b/libs/sysplugins/smarty_internal_config_file_compiler.php index 61328ce2..1afb92c3 100644 --- a/libs/sysplugins/smarty_internal_config_file_compiler.php +++ b/libs/sysplugins/smarty_internal_config_file_compiler.php @@ -105,6 +105,9 @@ class Smarty_Internal_Config_File_Compiler array($this->template->source->filepath, $this->template->source->getTimeStamp(), $this->template->source->type); if ($this->smarty->debugging) { + if (!isset( $this->smarty->_debug)) { + $this->smarty->_debug = new Smarty_Internal_Debug(); + } $this->smarty->_debug->start_compile($this->template); } // init the lexer/parser to compile the config file diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 35d49d17..4b7f96c0 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -160,6 +160,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { $parentIsTpl = isset($this->parent) && $this->parent->_objType == 2; if ($this->smarty->debugging) { + if (!isset($this->smarty->_debug)) { + $this->smarty->_debug = new Smarty_Internal_Debug(); + } $this->smarty->_debug->start_template($this, $display); } // checks if template exists @@ -339,6 +342,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase $tpl->_cache = array(); if (isset($uid)) { if ($smarty->debugging) { + if (!isset($smarty->_debug)) { + $smarty->_debug = new Smarty_Internal_Debug(); + } $smarty->_debug->start_template($tpl); $smarty->_debug->start_render($tpl); } diff --git a/libs/sysplugins/smarty_internal_templatecompilerbase.php b/libs/sysplugins/smarty_internal_templatecompilerbase.php index e2681800..9ce910fd 100644 --- a/libs/sysplugins/smarty_internal_templatecompilerbase.php +++ b/libs/sysplugins/smarty_internal_templatecompilerbase.php @@ -360,6 +360,9 @@ abstract class Smarty_Internal_TemplateCompilerBase $this->plugin_search_order = $this->template->smarty->plugin_search_order; } if ($this->smarty->debugging) { + if (!isset($this->smarty->_debug)) { + $this->smarty->_debug = new Smarty_Internal_Debug(); + } $this->smarty->_debug->start_compile($this->template); } if (isset($this->template->smarty->security_policy)) { @@ -588,7 +591,8 @@ abstract class Smarty_Internal_TemplateCompilerBase if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) { $this->tag_nocache = true; } - return call_user_func_array($this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], array($new_args, $this)); + return call_user_func_array($this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 0 ], + array($new_args, $this)); } // compile registered function or block function if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) { @@ -661,7 +665,8 @@ abstract class Smarty_Internal_TemplateCompilerBase foreach ($args as $mixed) { $new_args = array_merge($new_args, $mixed); } - return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], array($new_args, $this)); + return call_user_func_array($this->default_handler_plugins[ $plugin_type ][ $tag ][ 0 ], + array($new_args, $this)); } else { return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag); @@ -712,7 +717,8 @@ abstract class Smarty_Internal_TemplateCompilerBase if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) { $this->tag_nocache = true; } - return call_user_func_array($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], array($args, $this)); + return call_user_func_array($this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 0 ], + array($args, $this)); } if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) { $plugin = 'smarty_compiler_' . $tag; diff --git a/libs/sysplugins/smarty_template_cached.php b/libs/sysplugins/smarty_template_cached.php index d44c2c43..58f0daf2 100644 --- a/libs/sysplugins/smarty_template_cached.php +++ b/libs/sysplugins/smarty_template_cached.php @@ -125,6 +125,9 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base { if ($this->isCached($_template)) { if ($_template->smarty->debugging) { + if (!isset($_template->smarty->_debug)) { + $_template->smarty->_debug = new Smarty_Internal_Debug(); + } $_template->smarty->_debug->start_cache($_template); } if (!$this->processed) { diff --git a/libs/sysplugins/smarty_template_compiled.php b/libs/sysplugins/smarty_template_compiled.php index a8a5aaff..01fdc123 100644 --- a/libs/sysplugins/smarty_template_compiled.php +++ b/libs/sysplugins/smarty_template_compiled.php @@ -147,6 +147,9 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base public function render(Smarty_Internal_Template $_template) { if ($_template->smarty->debugging) { + if (!isset($_template->smarty->_debug)) { + $_template->smarty->_debug = new Smarty_Internal_Debug(); + } $_template->smarty->_debug->start_render($_template); } if (!$this->processed) {