- 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 =====
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
- bugfix on error message in smarty_internal_compile_block.php
- bugfix mb handling in strip modifier

View File

@@ -2,10 +2,10 @@
/**
* Smarty Internal Plugin Configfilelexer
*
* This is the lexer to break the config file source into tokens
* This is the lexer to break the config file source into tokens
* @package Smarty
* @subpackage Config
* @author Uwe Tews
* @author Uwe Tews
*/
/**
* Smarty Internal Plugin Configfilelexer
@@ -22,16 +22,16 @@ class Smarty_Internal_Configfilelexer
private $state = 1;
public $smarty_token_names = array ( // Text for parser error messages
);
function __construct($data, $smarty)
{
// set instance object
self::instance($this);
self::instance($this);
$this->data = $data . "\n"; //now all lines are \n-terminated
$this->counter = 0;
$this->line = 1;
$this->smarty = $smarty;
$this->smarty = $smarty;
}
public static function &instance($new_instance = null)
{
@@ -39,7 +39,7 @@ class Smarty_Internal_Configfilelexer
if (isset($new_instance) && is_object($new_instance))
$instance = $new_instance;
return $instance;
}
}
@@ -183,15 +183,15 @@ class Smarty_Internal_Configfilelexer
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
6 => 1,
8 => 0,
9 => 0,
10 => 0,
);
if ($this->counter >= strlen($this->data)) {
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 {
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->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")) ) {
@@ -288,13 +288,13 @@ class Smarty_Internal_Configfilelexer
$this->yypopstate();
}
}
function yy_r2_8($yy_subpatterns)
function yy_r2_9($yy_subpatterns)
{
$this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
$this->yypopstate();
}
function yy_r2_9($yy_subpatterns)
function yy_r2_10($yy_subpatterns)
{
$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
$ptr = self::get_debug_vars($obj);
if ($obj instanceof Smarty) {
$smarty = $obj;
$smarty = clone $obj;
} else {
$smarty = $obj->smarty;
$smarty = clone $obj->smarty;
}
$_assigned_vars = $ptr->tpl_vars;
ksort($_assigned_vars);
$_config_vars = $ptr->config_vars;
ksort($_config_vars);
$ldelim = $smarty->left_delimiter;
$rdelim = $smarty->right_delimiter;
$smarty->left_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->caching = 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('execution_time', microtime(true) - $smarty->start_time);
echo $_template->getRenderedTemplate();
$smarty->left_delimiter = $ldelim;
$smarty->right_delimiter = $rdelim;
}
/*
* Recursively gets variables from all template/data scopes