diff --git a/change_log.txt b/change_log.txt index 91dfdd37..83b0374a 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,7 @@  ===== 3.1.28-dev===== (xx.xx.2015) 13.12.2015 - bugfix {foreach} and {section} with uppercase characters in name attribute did not work (forum topic 25819) + - bugfix $smarty->debugging_ctrl = 'URL' did not work (forum topic 25811) 09.12.2015 - bugix Smarty did fail under PHP 7.0.0 with use_include_path = true; diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index b926e006..cb297ccb 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -118,7 +118,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.28-dev/80'; + const SMARTY_VERSION = '3.1.28-dev/81'; /** * define variable scopes @@ -1094,8 +1094,12 @@ class Smarty extends Smarty_Internal_TemplateBase $tpl->tpl_vars[$_key] = new Smarty_Variable($_val); } } - if ($this->debugging) { + if ($this->debugging || $this->debugging_ctrl == 'URL') { $tpl->smarty->_debug = new Smarty_Internal_Debug(); + // check URL debugging control + if (!$this->debugging && $this->debugging_ctrl == 'URL') { + $tpl->smarty->_debug->debugUrl($tpl->smarty); + } } return $tpl; } diff --git a/libs/sysplugins/smarty_internal_debug.php b/libs/sysplugins/smarty_internal_debug.php index e330a35c..0cbd5495 100644 --- a/libs/sysplugins/smarty_internal_debug.php +++ b/libs/sysplugins/smarty_internal_debug.php @@ -399,31 +399,31 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data /** * handle 'URL' debugging mode * - * @param Smarty_Internal_Template $_template + * @param Smarty $smarty */ - public function debugUrl(Smarty_Internal_Template $_template) + public function debugUrl(Smarty $smarty) { if (isset($_SERVER['QUERY_STRING'])) { $_query_string = $_SERVER['QUERY_STRING']; } else { $_query_string = ''; } - if (false !== strpos($_query_string, $_template->smarty->smarty_debug_id)) { - if (false !== strpos($_query_string, $_template->smarty->smarty_debug_id . '=on')) { + if (false !== strpos($_query_string, $smarty->smarty_debug_id)) { + if (false !== strpos($_query_string, $smarty->smarty_debug_id . '=on')) { // enable debugging for this browser session setcookie('SMARTY_DEBUG', true); - $_template->smarty->debugging = true; - } elseif (false !== strpos($_query_string, $_template->smarty->smarty_debug_id . '=off')) { + $smarty->debugging = true; + } elseif (false !== strpos($_query_string, $smarty->smarty_debug_id . '=off')) { // disable debugging for this browser session setcookie('SMARTY_DEBUG', false); - $_template->smarty->debugging = false; + $smarty->debugging = false; } else { // enable debugging for this page - $_template->smarty->debugging = true; + $smarty->debugging = true; } } else { if (isset($_COOKIE['SMARTY_DEBUG'])) { - $_template->smarty->debugging = true; + $smarty->debugging = true; } } } diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 52c7391b..64eeaa10 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -138,10 +138,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase } throw new SmartyException("Unable to load template {$this->source->type} '{$this->source->name}'{$parent_resource}"); } - // check URL debugging control - if (!$this->smarty->debugging && $this->smarty->debugging_ctrl == 'URL') { - $this->smarty->_debug->debugUrl($this); - } // disable caching for evaluated code if ($this->source->handler->recompiled) { $this->caching = false;