- avoid possible circular object referances caused by parser/lexer objects

This commit is contained in:
Uwe Tews
2015-08-06 01:19:11 +02:00
parent ca969fe663
commit e1cc514a68
47 changed files with 674 additions and 492 deletions

View File

@@ -43,13 +43,14 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
/**
* Compiles code for the {include_php} tag
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
* @param array $args array with attributes from parser
* @param \Smarty_Internal_TemplateCompilerBase $compiler compiler object
*
* @throws SmartyException
* @return string compiled code
* @return string
* @throws \SmartyCompilerException
* @throws \SmartyException
*/
public function compile($args, $compiler)
public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler)
{
if (!($compiler->smarty instanceof SmartyBC)) {
throw new SmartyException("{include_php} is deprecated, use SmartyBC class to enable");
@@ -63,7 +64,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
$_smarty_tpl = $compiler->template;
$_filepath = false;
$_file = null;
eval('$_file = ' . $_attr['file'] . ';');
eval('$_file = @' . $_attr['file'] . ';');
if (!isset($compiler->smarty->security_policy) && file_exists($_file)) {
$_filepath = $compiler->smarty->_realpath($_file, true);
} else {
@@ -83,7 +84,7 @@ class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
}
}
if ($_filepath == false) {
$compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", $compiler->lex->taglineno);
$compiler->trigger_template_error("{include_php} file '{$_file}' is not readable", null, true);
}
if (isset($compiler->smarty->security_policy)) {