- bugfix on {block} if name did contain '-'

This commit is contained in:
uwe.tews@googlemail.com
2010-11-17 19:07:59 +00:00
parent 6d4b6accfd
commit f49ac309b9
3 changed files with 6 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
17/11/2010
- bugfix on {call} with variable function name
- bugfix on {block} if name did contain '-'
16/11/2010
- bugfix whitespace in front of "<?php" in smarty_internal_compile_private_block_plugin.php

View File

@@ -49,7 +49,7 @@ class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
$_rdl = preg_quote($template->smarty->right_delimiter);
$_ldl = preg_quote($template->smarty->left_delimiter);
if (0 == preg_match("!({$_ldl}block\s+)(name=)?(\w+|'\w+'|\"\w+\")(\s*?)?((append|prepend|nocache)(=true)?)?(\s*{$_rdl})!", $block_tag, $_match)) {
if (0 == preg_match("!({$_ldl}block\s+)(name=)?(\w+|'.*'|\".*\")(\s*?)?((append|prepend|nocache)(=true)?)?(\s*{$_rdl})!", $block_tag, $_match)) {
$error_text = 'Syntax Error in template "' . $template->getTemplateFilepath() . '" "' . htmlspecialchars($block_tag) . '" illegal options';
throw new SmartyCompilerException($error_text);
} else {
@@ -167,6 +167,7 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
$_attr = $this->_get_attributes($args);
$saved_data = $this->_close_tag(array('block'));
$_name = trim($saved_data[0]['name'], "\"'");
var_dump($_name);
if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {

View File

@@ -38,7 +38,7 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
// output will be stored in a smarty variable instead of beind displayed
$_assign = $_attr['assign'];
}
$_name = trim($_attr['name'], "'\"");
$_name = $_attr['name'];
unset($_attr['name'], $_attr['assign'], $_attr['nocache']);
// set flag (compiled code of {function} must be included in cache file
if ($compiler->nocache || $compiler->tag_nocache) {
@@ -78,8 +78,9 @@ class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
//varibale name?
if (!(strpos($_name,'$')===false)) {
$call_cache = $_name;
$call_function = "\$tmp = \"smarty_template_function_{{$_name}}\"; \$tmp";
$call_function = '$tmp = "smarty_template_function_".'.$_name.'; $tmp';
} else {
$_name = trim($_name, "'\"");
$call_cache = "'{$_name}'";
$call_function = 'smarty_template_function_'.$_name;
}