From cf24bf8717771a71a41441a141e282ff7d2dcaf9 Mon Sep 17 00:00:00 2001 From: andrey Date: Fri, 23 Mar 2001 20:02:13 +0000 Subject: [PATCH] Fixed nested include infinite repeat bug. --- NEWS | 3 ++- Smarty_Compiler.class.php | 6 +++++- libs/Smarty_Compiler.class.php | 6 +++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index a710961c..e1516310 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ - - added optional HTML header to output (Monte) + - fixed a bug that caused some nested includes to loop infinitely. (Andrei) + - added optional HTML header to output. (Monte) - significantly improved config_load performance. (Andrei) - added format attribute to math function. (Monte) - added html_select_time custom function. (Andrei) diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index c8845e4d..55d682f1 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -456,7 +456,11 @@ class Smarty_Compiler extends Smarty { " include \"\$file_name.php\";\n" . " }\n" . "}\n" . - "$include_func_name($include_file_name, get_defined_vars(), array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; + "\$_smarty_defined_vars = get_defined_vars();\n" . + "unset(\$_smarty_defined_vars['file_name']);\n" . + "unset(\$_smarty_defined_vars['def_vars']);\n" . + "unset(\$_smarty_defined_vars['include_vars']);\n" . + "$include_func_name($include_file_name, \$_smarty_defined_vars, array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; } /*======================================================================*\ diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index c8845e4d..55d682f1 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -456,7 +456,11 @@ class Smarty_Compiler extends Smarty { " include \"\$file_name.php\";\n" . " }\n" . "}\n" . - "$include_func_name($include_file_name, get_defined_vars(), array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; + "\$_smarty_defined_vars = get_defined_vars();\n" . + "unset(\$_smarty_defined_vars['file_name']);\n" . + "unset(\$_smarty_defined_vars['def_vars']);\n" . + "unset(\$_smarty_defined_vars['include_vars']);\n" . + "$include_func_name($include_file_name, \$_smarty_defined_vars, array(".implode(',', (array)$arg_list)."), \$_smarty_config);\n?>"; } /*======================================================================*\