- 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
- added attribute cache_id to {include} tag

View File

@@ -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);

View File

@@ -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'])) {

View File

@@ -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);

View File

@@ -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) {

View File

@@ -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 = '<?php ';
// save posible attributes

View File

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

View File

@@ -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 '';

View File

@@ -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') {