- bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452}

This commit is contained in:
Uwe Tews
2015-03-20 00:41:55 +01:00
parent 03c7b786a0
commit 4ecc75344f
4 changed files with 12 additions and 5 deletions

View File

@@ -1,4 +1,7 @@
 ===== 3.1.22-dev ===== (xx.xx.2015)
20.03.2015
- bugfix make sure that function properties get saved only in compiled files containing the fuction definition {forum topic 25452}
16.03.2015
- bugfix problems with {function}{/function} and {call} tags in different subtemplate cache files {forum topic 25452}
- bugfix Smarty_Security->allow_constants=false; did not disallow direct usage of defined constants like {SMARTY_DIR} {forum topic 25457}

View File

@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
/**
* smarty version
*/
const SMARTY_VERSION = '3.1.22-dev/14';
const SMARTY_VERSION = '3.1.22-dev/11';
/**
* define variable scopes

View File

@@ -32,12 +32,19 @@ class Smarty_Internal_Extension_CodeFrame
if (!isset($_template->properties['unifunc'])) {
$_template->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
}
$properties = $_template->properties;
if (!$cache) {
unset($properties['tpl_function']);
if (!empty($_template->compiler->templateProperties)) {
$properties['tpl_function'] = $_template->compiler->templateProperties['tpl_function'];
}
}
$output = "<?php\n";
$output .= "/*%%SmartyHeaderCode:{$_template->properties['nocache_hash']}%%*/\n";
if ($_template->smarty->direct_access_security) {
$output .= "if(!defined('SMARTY_DIR')) exit('no direct access allowed');\n";
}
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($_template->properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n";
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($properties, true) . ',' . ($cache ? 'true' : 'false') . ");\n";
$output .= "/*/%%SmartyHeaderCode%%*/\n";
$output .= "if (\$_valid && !is_callable('{$_template->properties['unifunc']}')) {\n";
$output .= "function {$_template->properties['unifunc']} (\$_smarty_tpl) {\n";

View File

@@ -325,9 +325,6 @@ abstract class Smarty_Internal_TemplateCompilerBase
if ((isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) && !$this->suppressFilter && $_compiled_code != '') {
$_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template);
}
if (!empty($this->templateProperties)) {
$this->template->properties['tpl_function'] = $this->templateProperties['tpl_function'];
}
if ($this->suppressTemplatePropertyHeader) {
$_compiled_code .= $merged_code;
} else {