- bugfix enable debugging could fail when template objects did already exists https://github.com/smarty-php/smarty/issues/237

This commit is contained in:
uwetews
2016-07-13 01:07:53 +02:00
parent 31f6afd16e
commit 38b13661fe
7 changed files with 27 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
13.07.2016 13.07.2016
- bugfix PHP 7 compatibility on registered compiler plugins https://github.com/smarty-php/smarty/issues/241 - 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 - 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 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 {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

View File

@@ -121,7 +121,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/** /**
* smarty version * smarty version
*/ */
const SMARTY_VERSION = '3.1.30-dev/76'; const SMARTY_VERSION = '3.1.30-dev/77';
/** /**
* define variable scopes * define variable scopes

View File

@@ -105,6 +105,9 @@ class Smarty_Internal_Config_File_Compiler
array($this->template->source->filepath, $this->template->source->getTimeStamp(), array($this->template->source->filepath, $this->template->source->getTimeStamp(),
$this->template->source->type); $this->template->source->type);
if ($this->smarty->debugging) { if ($this->smarty->debugging) {
if (!isset( $this->smarty->_debug)) {
$this->smarty->_debug = new Smarty_Internal_Debug();
}
$this->smarty->_debug->start_compile($this->template); $this->smarty->_debug->start_compile($this->template);
} }
// init the lexer/parser to compile the config file // init the lexer/parser to compile the config file

View File

@@ -160,6 +160,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
{ {
$parentIsTpl = isset($this->parent) && $this->parent->_objType == 2; $parentIsTpl = isset($this->parent) && $this->parent->_objType == 2;
if ($this->smarty->debugging) { if ($this->smarty->debugging) {
if (!isset($this->smarty->_debug)) {
$this->smarty->_debug = new Smarty_Internal_Debug();
}
$this->smarty->_debug->start_template($this, $display); $this->smarty->_debug->start_template($this, $display);
} }
// checks if template exists // checks if template exists
@@ -339,6 +342,9 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
$tpl->_cache = array(); $tpl->_cache = array();
if (isset($uid)) { if (isset($uid)) {
if ($smarty->debugging) { if ($smarty->debugging) {
if (!isset($smarty->_debug)) {
$smarty->_debug = new Smarty_Internal_Debug();
}
$smarty->_debug->start_template($tpl); $smarty->_debug->start_template($tpl);
$smarty->_debug->start_render($tpl); $smarty->_debug->start_render($tpl);
} }

View File

@@ -360,6 +360,9 @@ abstract class Smarty_Internal_TemplateCompilerBase
$this->plugin_search_order = $this->template->smarty->plugin_search_order; $this->plugin_search_order = $this->template->smarty->plugin_search_order;
} }
if ($this->smarty->debugging) { if ($this->smarty->debugging) {
if (!isset($this->smarty->_debug)) {
$this->smarty->_debug = new Smarty_Internal_Debug();
}
$this->smarty->_debug->start_compile($this->template); $this->smarty->_debug->start_compile($this->template);
} }
if (isset($this->template->smarty->security_policy)) { 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 ]) { if (!$this->smarty->registered_plugins[ $plugin_type ][ $tag ][ 1 ]) {
$this->tag_nocache = true; $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 // compile registered function or block function
if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) { if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) {
@@ -661,7 +665,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
foreach ($args as $mixed) { foreach ($args as $mixed) {
$new_args = array_merge($new_args, $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 { } else {
return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter,
$tag); $tag);
@@ -712,7 +717,8 @@ abstract class Smarty_Internal_TemplateCompilerBase
if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) { if (!$this->smarty->registered_plugins[ Smarty::PLUGIN_COMPILER ][ $tag ][ 1 ]) {
$this->tag_nocache = true; $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)) { if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
$plugin = 'smarty_compiler_' . $tag; $plugin = 'smarty_compiler_' . $tag;

View File

@@ -125,6 +125,9 @@ class Smarty_Template_Cached extends Smarty_Template_Resource_Base
{ {
if ($this->isCached($_template)) { if ($this->isCached($_template)) {
if ($_template->smarty->debugging) { if ($_template->smarty->debugging) {
if (!isset($_template->smarty->_debug)) {
$_template->smarty->_debug = new Smarty_Internal_Debug();
}
$_template->smarty->_debug->start_cache($_template); $_template->smarty->_debug->start_cache($_template);
} }
if (!$this->processed) { if (!$this->processed) {

View File

@@ -147,6 +147,9 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
public function render(Smarty_Internal_Template $_template) public function render(Smarty_Internal_Template $_template)
{ {
if ($_template->smarty->debugging) { if ($_template->smarty->debugging) {
if (!isset($_template->smarty->_debug)) {
$_template->smarty->_debug = new Smarty_Internal_Debug();
}
$_template->smarty->_debug->start_render($_template); $_template->smarty->_debug->start_render($_template);
} }
if (!$this->processed) { if (!$this->processed) {