- bugfix do not run filters and default modifier when displaying the debug template

- bugfix of embedded double quotes within multi line strings (""")
This commit is contained in:
uwe.tews@googlemail.com
2011-04-01 08:41:57 +00:00
parent 1757b274d6
commit d999a7bc5c
3 changed files with 22 additions and 19 deletions

View File

@@ -1,4 +1,8 @@
===== SVN trunk ===== ===== SVN trunk =====
01/04/2011
- bugfix do not run filters and default modifier when displaying the debug template
- bugfix of embedded double quotes within multi line strings (""")
29/03/2011 29/03/2011
- bugfix on error message in smarty_internal_compile_block.php - bugfix on error message in smarty_internal_compile_block.php
- bugfix mb handling in strip modifier - bugfix mb handling in strip modifier

View File

@@ -183,15 +183,15 @@ class Smarty_Internal_Configfilelexer
3 => 0, 3 => 0,
4 => 0, 4 => 0,
5 => 0, 5 => 0,
6 => 0, 6 => 1,
7 => 0,
8 => 0, 8 => 0,
9 => 0, 9 => 0,
10 => 0,
); );
if ($this->counter >= strlen($this->data)) { if ($this->counter >= strlen($this->data)) {
return false; // end of input return false; // end of input
} }
$yy_global_pattern = "/^([ \t\r]+)|^(\\d+\\.\\d+(?=[ \t\r]*[\n#]))|^(\\d+(?=[ \t\r]*[\n#]))|^('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#]))|^(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#]))|^(\"\"\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"\"\"(?=[ \t\r]*[\n#]))|^([a-zA-Z]+(?=[ \t\r]*[\n#]))|^([^\n]+?(?=[ \t\r]*\n))|^(\n)/iS"; $yy_global_pattern = "/^([ \t\r]+)|^(\\d+\\.\\d+(?=[ \t\r]*[\n#]))|^(\\d+(?=[ \t\r]*[\n#]))|^('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#]))|^(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#]))|^(\"\"\"([^\"]|\\\\\"|\"{1,2}[^\"])*\"\"\"(?=[ \t\r]*[\n#]))|^([a-zA-Z]+(?=[ \t\r]*[\n#]))|^([^\n]+?(?=[ \t\r]*\n))|^(\n)/iS";
do { do {
if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) { if (preg_match($yy_global_pattern, substr($this->data, $this->counter), $yymatches)) {
@@ -276,7 +276,7 @@ class Smarty_Internal_Configfilelexer
$this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_DOUBLE_QUOTED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_DOUBLE_QUOTED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r2_7($yy_subpatterns) function yy_r2_8($yy_subpatterns)
{ {
if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) { if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) {
@@ -288,13 +288,13 @@ class Smarty_Internal_Configfilelexer
$this->yypopstate(); $this->yypopstate();
} }
} }
function yy_r2_8($yy_subpatterns) function yy_r2_9($yy_subpatterns)
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->yypopstate(); $this->yypopstate();
} }
function yy_r2_9($yy_subpatterns) function yy_r2_10($yy_subpatterns)
{ {
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING; $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;

View File

@@ -78,18 +78,19 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
// prepare information of assigned variables // prepare information of assigned variables
$ptr = self::get_debug_vars($obj); $ptr = self::get_debug_vars($obj);
if ($obj instanceof Smarty) { if ($obj instanceof Smarty) {
$smarty = $obj; $smarty = clone $obj;
} else { } else {
$smarty = $obj->smarty; $smarty = clone $obj->smarty;
} }
$_assigned_vars = $ptr->tpl_vars; $_assigned_vars = $ptr->tpl_vars;
ksort($_assigned_vars); ksort($_assigned_vars);
$_config_vars = $ptr->config_vars; $_config_vars = $ptr->config_vars;
ksort($_config_vars); ksort($_config_vars);
$ldelim = $smarty->left_delimiter;
$rdelim = $smarty->right_delimiter;
$smarty->left_delimiter = '{'; $smarty->left_delimiter = '{';
$smarty->right_delimiter = '}'; $smarty->right_delimiter = '}';
$smarty->registered_filters = array();
$smarty->autoload_filters = array();
$smarty->default_modifiers = array();
$_template = new Smarty_Internal_Template ($smarty->debug_tpl, $smarty); $_template = new Smarty_Internal_Template ($smarty->debug_tpl, $smarty);
$_template->caching = false; $_template->caching = false;
$_template->force_compile = false; $_template->force_compile = false;
@@ -108,8 +109,6 @@ class Smarty_Internal_Debug extends Smarty_Internal_Data {
$_template->assign('config_vars', $_config_vars); $_template->assign('config_vars', $_config_vars);
$_template->assign('execution_time', microtime(true) - $smarty->start_time); $_template->assign('execution_time', microtime(true) - $smarty->start_time);
echo $_template->getRenderedTemplate(); echo $_template->getRenderedTemplate();
$smarty->left_delimiter = $ldelim;
$smarty->right_delimiter = $rdelim;
} }
/* /*
* Recursively gets variables from all template/data scopes * Recursively gets variables from all template/data scopes