From f49ac309b9ee7dbd0670eeae7bdc24d67abcee13 Mon Sep 17 00:00:00 2001 From: "uwe.tews@googlemail.com" Date: Wed, 17 Nov 2010 19:07:59 +0000 Subject: [PATCH] - bugfix on {block} if name did contain '-' --- change_log.txt | 1 + libs/sysplugins/smarty_internal_compile_block.php | 3 ++- libs/sysplugins/smarty_internal_compile_call.php | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/change_log.txt b/change_log.txt index 427ddf12..9afbdcf6 100644 --- a/change_log.txt +++ b/change_log.txt @@ -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 "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 { diff --git a/libs/sysplugins/smarty_internal_compile_call.php b/libs/sysplugins/smarty_internal_compile_call.php index 144bbb6e..50ba6328 100644 --- a/libs/sysplugins/smarty_internal_compile_call.php +++ b/libs/sysplugins/smarty_internal_compile_call.php @@ -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; }