diff options
| author | uwe.tews@googlemail.com <uwe.tews@googlemail.com> | 2010-11-18 18:58:53 +0000 |
|---|---|---|
| committer | uwe.tews@googlemail.com <uwe.tews@googlemail.com> | 2010-11-18 18:58:53 +0000 |
| commit | eddb3019470ab65f13c49de2fd98db175fac3e11 (patch) | |
| tree | 8e93061a60c85529c06b3b6394d01ed73827e18e /libs/sysplugins/smarty_internal_data.php | |
| parent | 6b9921baaeda9902068374ff8a0083e16dd7b64c (diff) | |
| download | smarty-eddb3019470ab65f13c49de2fd98db175fac3e11.tar.gz smarty-eddb3019470ab65f13c49de2fd98db175fac3e11.tar.bz2 smarty-eddb3019470ab65f13c49de2fd98db175fac3e11.zip | |
- change on handling of unassigned template variable -- default will drop E_NOTICE
- bugfix on Smarty2 wrapper load_filter() did not work
Diffstat (limited to 'libs/sysplugins/smarty_internal_data.php')
| -rw-r--r-- | libs/sysplugins/smarty_internal_data.php | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 40482f44..9246f7f6 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -259,14 +259,14 @@ class Smarty_Internal_Data { * @param boolean $search_parents search also in parent data * @return object the object of the variable */ - public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true) + public function getVariable($_variable, $_ptr = null, $search_parents = true, $error_enable = true) { if ($_ptr === null) { $_ptr = $this; } while ($_ptr !== null) { - if (isset($_ptr->tpl_vars[$variable])) { + if (isset($_ptr->tpl_vars[$_variable])) { // found it, return it - return $_ptr->tpl_vars[$variable]; + return $_ptr->tpl_vars[$_variable]; } // not found, try at parent if ($search_parents) { @@ -275,13 +275,17 @@ class Smarty_Internal_Data { $_ptr = null; } } - if (isset(Smarty::$global_tpl_vars[$variable])) { + if (isset(Smarty::$global_tpl_vars[$_variable])) { // found it, return it - return Smarty::$global_tpl_vars[$variable]; + return Smarty::$global_tpl_vars[$_variable]; } if ($this->smarty->error_unassigned && $error_enable) { - throw new SmartyException('Undefined Smarty variable "' . $variable . '"'); + throw new SmartyException('Undefined Smarty variable "' . $_variable . '"'); } else { + if ($error_enable) { + // force a notice + $x = $$_variable; + } return new Undefined_Smarty_Variable; } } @@ -291,23 +295,26 @@ class Smarty_Internal_Data { * @param string $variable the name of the config variable * @return mixed the value of the config variable */ - public function getConfigVariable($variable) + public function getConfigVariable($_variable) { $_ptr = $this; while ($_ptr !== null) { - if (isset($_ptr->config_vars[$variable])) { + if (isset($_ptr->config_vars[$_variable])) { // found it, return it - return $_ptr->config_vars[$variable]; + return $_ptr->config_vars[$_variable]; } // not found, try at parent $_ptr = $_ptr->parent; } if ($this->smarty->error_unassigned) { - throw new SmartyException('Undefined config variable "' . $variable . '"'); + throw new SmartyException('Undefined config variable "' . $_variable . '"'); } else { + // force a notice + $x = $$_variable; return null; } } + /** * gets a stream variable * |
