From f621da887577869420f5509484e6f9eb1af9b138 Mon Sep 17 00:00:00 2001 From: mohrt Date: Tue, 30 Oct 2001 20:52:50 +0000 Subject: [PATCH] fixed bug in assign function when passing an empty value --- NEWS | 2 ++ Smarty.addons.php | 2 +- Smarty.class.php | 7 ++++--- Smarty_Compiler.class.php | 1 + demo/templates/debug.tpl | 2 ++ libs/Smarty.class.php | 7 ++++--- libs/Smarty_Compiler.class.php | 1 + templates/debug.tpl | 2 ++ 8 files changed, 17 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index d3cb9445..a461e5a0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ + - fixed bug with {assign ...} when passing an empty value (Monte) + - add more warning message fixes (Monte, Tara Johnson) - documentation updates. (Monte) - update fetch function to give proper warning when fetching a non-readable or non-existant file. (Monte) diff --git a/Smarty.addons.php b/Smarty.addons.php index 7ddf05d2..572ff374 100644 --- a/Smarty.addons.php +++ b/Smarty.addons.php @@ -193,7 +193,7 @@ function smarty_func_assign($args, &$smarty_obj) return; } - if (empty($value)) { + if (!isset($value)) { $smarty_obj->_trigger_error_msg("assign: missing 'value' parameter"); return; } diff --git a/Smarty.class.php b/Smarty.class.php index 1289aeb5..0060f2ba 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -236,8 +236,9 @@ class Smarty { if (is_array($tpl_var)){ foreach ($tpl_var as $key => $val) { - if (!empty($key)) + if (!empty($key) && isset($val)) { $this->_tpl_vars[$key] = $val; + } } } else { if (!empty($tpl_var) && isset($value)) @@ -650,7 +651,7 @@ class Smarty $smarty['request'] = array_merge($smarty['request'], $smarty[$egpcs[$c]]); } } - $smarty['request'] = array_merge($smarty['request'], $smarty['session']); + $smarty['request'] = @array_merge($smarty['request'], $smarty['session']); $smarty['now'] = time(); @@ -1193,7 +1194,7 @@ function _run_mod_handler() $new_dir = ($dir{0} == '/') ? '/' : ''; foreach ($dir_parts as $dir_part) { $new_dir .= $dir_part; - if (!file_exists($new_dir) && !mkdir($new_dir, 0701)) { + if (!file_exists($new_dir) && !mkdir($new_dir, 0771)) { $this->_trigger_error_msg("problem creating directory \"$dir\""); return false; } diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 742fe327..b502b38c 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -401,6 +401,7 @@ class Smarty_Compiler extends Smarty { function _compile_include_tag($tag_args) { $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); if (empty($attrs['file'])) { $this->_syntax_error("missing 'file' attribute in include tag"); diff --git a/demo/templates/debug.tpl b/demo/templates/debug.tpl index e0aa1e95..88a99175 100644 --- a/demo/templates/debug.tpl +++ b/demo/templates/debug.tpl @@ -1,5 +1,7 @@ {* Smarty *} +{* debug.tpl, last updated version 1.4.6 *} + {assign_debug_info}