- fixed E_STRICT errors for uninitialized variables

This commit is contained in:
Uwe.Tews
2010-08-23 14:40:10 +00:00
parent ee15e53542
commit 96e3d9937a
9 changed files with 18 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
23/08/2010
- fixed E_STRICT errors for uninitialized variables
22/08/2010 22/08/2010
- added attribute cache_id to {include} tag - added attribute cache_id to {include} tag

View File

@@ -61,6 +61,7 @@ function smarty_function_html_table($params, $smarty, $template)
$hdir = 'right'; $hdir = 'right';
$inner = 'cols'; $inner = 'cols';
$caption = ''; $caption = '';
$loop = null;
if (!isset($params['loop'])) { if (!isset($params['loop'])) {
trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING); trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING);

View File

@@ -63,7 +63,7 @@ function smarty_function_math($params, $smarty, $template)
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation); $equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
} }
} }
$smarty_math_result = null;
eval("\$smarty_math_result = ".$equation.";"); eval("\$smarty_math_result = ".$equation.";");
if (empty($params['format'])) { if (empty($params['format'])) {

View File

@@ -31,7 +31,7 @@ class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
// check and get attributes // check and get attributes
$_attr = $this->_get_attributes($args); $_attr = $this->_get_attributes($args);
$_smarty_tpl = $compiler->template; $_smarty_tpl = $compiler->template;
// $include_file = ''; $include_file = null;
eval('$include_file = ' . $_attr['file'] . ';'); eval('$include_file = ' . $_attr['file'] . ';');
// create template object // create template object
$_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template); $_template = new $compiler->smarty->template_class($include_file, $this->smarty, $compiler->template);

View File

@@ -34,7 +34,8 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
if ($compiler->smarty->merge_compiled_includes || isset($_attr['inline'])) { if ($compiler->smarty->merge_compiled_includes || isset($_attr['inline'])) {
// check if compiled code can be merged (contains no variable part) // 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) { 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) { if ($this->compiler->template->template_resource != $tmp) {
$tpl = $compiler->smarty->createTemplate ($tmp, $compiler->template->cache_id, $compiler->template->compile_id, $compiler->template); $tpl = $compiler->smarty->createTemplate ($tmp, $compiler->template->cache_id, $compiler->template->compile_id, $compiler->template);
if ($this->compiler->template->caching) { if ($this->compiler->template->caching) {

View File

@@ -32,6 +32,8 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
$this->compiler->suppressNocacheProcessing = true; $this->compiler->suppressNocacheProcessing = true;
$this->compiler->tag_nocache = true; $this->compiler->tag_nocache = true;
$_smarty_tpl = $compiler->template; $_smarty_tpl = $compiler->template;
$_name = null;
$_script = null;
$_output = '<?php '; $_output = '<?php ';
// save posible attributes // save posible attributes

View File

@@ -243,6 +243,7 @@ class Smarty_Internal_Config {
if ($this->mustCompile()) { if ($this->mustCompile()) {
$this->compileConfigSource(); $this->compileConfigSource();
} }
$_config_vars = array();
include($this->getCompiledFilepath ()); include($this->getCompiledFilepath ());
// copy global config vars // copy global config vars
foreach ($_config_vars['vars'] as $variable => $value) { foreach ($_config_vars['vars'] as $variable => $value) {

View File

@@ -332,7 +332,7 @@ class Smarty_Internal_Data {
return $_result; return $_result;
} }
if ($this->smarty->$error_unassigned) { if ($this->smarty->error_unassigned) {
throw new SmartyException('Undefined stream variable "' . $variable . '"'); throw new SmartyException('Undefined stream variable "' . $variable . '"');
} else { } else {
return ''; return '';

View File

@@ -375,11 +375,13 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
} }
$this->cacheFileChecked = true; $this->cacheFileChecked = true;
if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] >= 0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) { if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] >= 0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) {
$this->tpl_vars = array(); $this->tpl_vars = array();
$this->rendered_content = null; $this->rendered_content = null;
return $this->isCached; return $this->isCached;
} }
if (!empty($this->properties['file_dependency']) && $this->smarty->compile_check) { 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) { foreach ($this->properties['file_dependency'] as $_file_to_check) {
$this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name); $this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name);
If ($resource_type == 'file') { If ($resource_type == 'file') {
@@ -429,6 +431,8 @@ class Smarty_Internal_Template extends Smarty_Internal_Data {
if ($this->smarty->compile_check) { if ($this->smarty->compile_check) {
if (!empty($this->properties['file_dependency'])) { if (!empty($this->properties['file_dependency'])) {
$this->mustCompile = false; $this->mustCompile = false;
$resource_type = null;
$resource_name = null;
foreach ($this->properties['file_dependency'] as $_file_to_check) { foreach ($this->properties['file_dependency'] as $_file_to_check) {
$this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name); $this->getResourceTypeName($_file_to_check[0], $resource_type, $resource_name);
If ($resource_type == 'file') { If ($resource_type == 'file') {