mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-10 03:00:55 +02:00
- avoid possible circular object referances caused by parser/lexer objects
This commit is contained in:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user