From 96e3d9937ab46d2397575efab3506382a2fe82f6 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Mon, 23 Aug 2010 14:40:10 +0000 Subject: [PATCH] - fixed E_STRICT errors for uninitialized variables --- change_log.txt | 3 +++ libs/plugins/function.html_table.php | 1 + libs/plugins/function.math.php | 2 +- libs/sysplugins/smarty_internal_compile_extends.php | 2 +- libs/sysplugins/smarty_internal_compile_include.php | 3 ++- libs/sysplugins/smarty_internal_compile_insert.php | 2 ++ libs/sysplugins/smarty_internal_config.php | 1 + libs/sysplugins/smarty_internal_data.php | 2 +- libs/sysplugins/smarty_internal_template.php | 8 ++++++-- 9 files changed, 18 insertions(+), 6 deletions(-) diff --git a/change_log.txt b/change_log.txt index bc4b8d6b..3f94e387 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +23/08/2010 +- fixed E_STRICT errors for uninitialized variables + 22/08/2010 - added attribute cache_id to {include} tag diff --git a/libs/plugins/function.html_table.php b/libs/plugins/function.html_table.php index 83e80300..f279ad6d 100644 --- a/libs/plugins/function.html_table.php +++ b/libs/plugins/function.html_table.php @@ -61,6 +61,7 @@ function smarty_function_html_table($params, $smarty, $template) $hdir = 'right'; $inner = 'cols'; $caption = ''; + $loop = null; if (!isset($params['loop'])) { trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING); diff --git a/libs/plugins/function.math.php b/libs/plugins/function.math.php index edeef5af..197f4df1 100644 --- a/libs/plugins/function.math.php +++ b/libs/plugins/function.math.php @@ -63,7 +63,7 @@ function smarty_function_math($params, $smarty, $template) $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation); } } - + $smarty_math_result = null; eval("\$smarty_math_result = ".$equation.";"); if (empty($params['format'])) { diff --git a/libs/sysplugins/smarty_internal_compile_extends.php b/libs/sysplugins/smarty_internal_compile_extends.php index 4075a962..b8196bd1 100644 --- a/libs/sysplugins/smarty_internal_compile_extends.php +++ b/libs/sysplugins/smarty_internal_compile_extends.php @@ -31,7 +31,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase { // check and get attributes $_attr = $this->_get_attributes($args); $_smarty_tpl = $compiler->template; - // $include_file = ''; + $include_file = null; eval('$include_file = ' . $_attr['file'] . ';'); // create template object $_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template); diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php index 7f0fee28..4c5d3f01 100644 --- a/libs/sysplugins/smarty_internal_compile_include.php +++ b/libs/sysplugins/smarty_internal_compile_include.php @@ -34,7 +34,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase { if ($compiler->smarty->merge_compiled_includes || isset($_attr['inline'])) { // check if compiled code can be merged (contains no variable part) if (!$compiler->has_variable_string && (substr_count($include_file, '"') == 2 or substr_count($include_file, "'") == 2) and substr_count($include_file, '(') == 0) { - eval("\$tmp = $include_file;"); + $tmp = null; + eval("\$tmp = $include_file;"); if ($this->compiler->template->template_resource != $tmp) { $tpl = $compiler->smarty->createTemplate ($tmp, $compiler->template->cache_id, $compiler->template->compile_id, $compiler->template); if ($this->compiler->template->caching) { diff --git a/libs/sysplugins/smarty_internal_compile_insert.php b/libs/sysplugins/smarty_internal_compile_insert.php index 94c9b3aa..f1b5e8eb 100644 --- a/libs/sysplugins/smarty_internal_compile_insert.php +++ b/libs/sysplugins/smarty_internal_compile_insert.php @@ -32,6 +32,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase { $this->compiler->suppressNocacheProcessing = true; $this->compiler->tag_nocache = true; $_smarty_tpl = $compiler->template; + $_name = null; + $_script = null; $_output = 'mustCompile()) { $this->compileConfigSource(); } + $_config_vars = array(); include($this->getCompiledFilepath ()); // copy global config vars foreach ($_config_vars['vars'] as $variable => $value) { diff --git a/libs/sysplugins/smarty_internal_data.php b/libs/sysplugins/smarty_internal_data.php index 8c35f83f..95a03c77 100644 --- a/libs/sysplugins/smarty_internal_data.php +++ b/libs/sysplugins/smarty_internal_data.php @@ -332,7 +332,7 @@ class Smarty_Internal_Data { return $_result; } - if ($this->smarty->$error_unassigned) { + if ($this->smarty->error_unassigned) { throw new SmartyException('Undefined stream variable "' . $variable . '"'); } else { return ''; diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index bda99e58..9f91ac6d 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -375,11 +375,13 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } $this->cacheFileChecked = true; if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] >= 0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) { - $this->tpl_vars = array(); - $this->rendered_content = null; + $this->tpl_vars = array(); + $this->rendered_content = null; return $this->isCached; } if (!empty($this->properties['file_dependency']) && $this->smarty->compile_check) { + $resource_type = null; + $resource_name = null; foreach ($this->properties['file_dependency'] as $_file_to_check) { $this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name); If ($resource_type == 'file') { @@ -429,6 +431,8 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { if ($this->smarty->compile_check) { if (!empty($this->properties['file_dependency'])) { $this->mustCompile = false; + $resource_type = null; + $resource_name = null; foreach ($this->properties['file_dependency'] as $_file_to_check) { $this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name); If ($resource_type == 'file') {