fixed bug in assign function when passing an empty value

This commit is contained in:
mohrt
2001-10-30 20:52:50 +00:00
parent d4022c9d33
commit f621da8875
8 changed files with 17 additions and 7 deletions

2
NEWS
View File

@@ -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) - documentation updates. (Monte)
- update fetch function to give proper warning when fetching a non-readable - update fetch function to give proper warning when fetching a non-readable
or non-existant file. (Monte) or non-existant file. (Monte)

View File

@@ -193,7 +193,7 @@ function smarty_func_assign($args, &$smarty_obj)
return; return;
} }
if (empty($value)) { if (!isset($value)) {
$smarty_obj->_trigger_error_msg("assign: missing 'value' parameter"); $smarty_obj->_trigger_error_msg("assign: missing 'value' parameter");
return; return;
} }

View File

@@ -236,9 +236,10 @@ class Smarty
{ {
if (is_array($tpl_var)){ if (is_array($tpl_var)){
foreach ($tpl_var as $key => $val) { foreach ($tpl_var as $key => $val) {
if (!empty($key)) if (!empty($key) && isset($val)) {
$this->_tpl_vars[$key] = $val; $this->_tpl_vars[$key] = $val;
} }
}
} else { } else {
if (!empty($tpl_var) && isset($value)) if (!empty($tpl_var) && isset($value))
$this->_tpl_vars[$tpl_var] = $value; $this->_tpl_vars[$tpl_var] = $value;
@@ -650,7 +651,7 @@ class Smarty
$smarty['request'] = array_merge($smarty['request'], $smarty[$egpcs[$c]]); $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(); $smarty['now'] = time();
@@ -1193,7 +1194,7 @@ function _run_mod_handler()
$new_dir = ($dir{0} == '/') ? '/' : ''; $new_dir = ($dir{0} == '/') ? '/' : '';
foreach ($dir_parts as $dir_part) { foreach ($dir_parts as $dir_part) {
$new_dir .= $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\""); $this->_trigger_error_msg("problem creating directory \"$dir\"");
return false; return false;
} }

View File

@@ -401,6 +401,7 @@ class Smarty_Compiler extends Smarty {
function _compile_include_tag($tag_args) function _compile_include_tag($tag_args)
{ {
$attrs = $this->_parse_attrs($tag_args); $attrs = $this->_parse_attrs($tag_args);
$arg_list = array();
if (empty($attrs['file'])) { if (empty($attrs['file'])) {
$this->_syntax_error("missing 'file' attribute in include tag"); $this->_syntax_error("missing 'file' attribute in include tag");

View File

@@ -1,5 +1,7 @@
{* Smarty *} {* Smarty *}
{* debug.tpl, last updated version 1.4.6 *}
{assign_debug_info} {assign_debug_info}
<SCRIPT language=javascript> <SCRIPT language=javascript>

View File

@@ -236,9 +236,10 @@ class Smarty
{ {
if (is_array($tpl_var)){ if (is_array($tpl_var)){
foreach ($tpl_var as $key => $val) { foreach ($tpl_var as $key => $val) {
if (!empty($key)) if (!empty($key) && isset($val)) {
$this->_tpl_vars[$key] = $val; $this->_tpl_vars[$key] = $val;
} }
}
} else { } else {
if (!empty($tpl_var) && isset($value)) if (!empty($tpl_var) && isset($value))
$this->_tpl_vars[$tpl_var] = $value; $this->_tpl_vars[$tpl_var] = $value;
@@ -650,7 +651,7 @@ class Smarty
$smarty['request'] = array_merge($smarty['request'], $smarty[$egpcs[$c]]); $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(); $smarty['now'] = time();
@@ -1193,7 +1194,7 @@ function _run_mod_handler()
$new_dir = ($dir{0} == '/') ? '/' : ''; $new_dir = ($dir{0} == '/') ? '/' : '';
foreach ($dir_parts as $dir_part) { foreach ($dir_parts as $dir_part) {
$new_dir .= $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\""); $this->_trigger_error_msg("problem creating directory \"$dir\"");
return false; return false;
} }

View File

@@ -401,6 +401,7 @@ class Smarty_Compiler extends Smarty {
function _compile_include_tag($tag_args) function _compile_include_tag($tag_args)
{ {
$attrs = $this->_parse_attrs($tag_args); $attrs = $this->_parse_attrs($tag_args);
$arg_list = array();
if (empty($attrs['file'])) { if (empty($attrs['file'])) {
$this->_syntax_error("missing 'file' attribute in include tag"); $this->_syntax_error("missing 'file' attribute in include tag");

View File

@@ -1,5 +1,7 @@
{* Smarty *} {* Smarty *}
{* debug.tpl, last updated version 1.4.6 *}
{assign_debug_info} {assign_debug_info}
<SCRIPT language=javascript> <SCRIPT language=javascript>