mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
treat unrecognized param attribute syntax as a string
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- treat unrecognized param attribute syntax as string (Monte)
|
||||||
- support $smarty.const.$foo syntax (messju, Monte)
|
- support $smarty.const.$foo syntax (messju, Monte)
|
||||||
- remove E_NOTICE warnings from debug.tpl,
|
- remove E_NOTICE warnings from debug.tpl,
|
||||||
escape modifier (Kanstantin, Monte)
|
escape modifier (Kanstantin, Monte)
|
||||||
|
@@ -1348,12 +1348,9 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$token = true;
|
$token = true;
|
||||||
} else if (preg_match('!^(off|no|false)$!', $token)) {
|
} else if (preg_match('!^(off|no|false)$!', $token)) {
|
||||||
$token = false;
|
$token = false;
|
||||||
} else if ($quote && preg_match('!^[\w\.-]+$!', $token)) {
|
|
||||||
/* If the token is just a string,
|
|
||||||
we double-quote it. */
|
|
||||||
$token = '"'.$token.'"';
|
|
||||||
} else if (!preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')?$!', $token)) {
|
} else if (!preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')?$!', $token)) {
|
||||||
$this->_syntax_error("invalid attribute value: '$token'", E_USER_ERROR, __FILE__, __LINE__);
|
/* treat as a string, double-quote it escaping quotes */
|
||||||
|
$token = '"'.addslashes($token).'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$attrs[$attr_name] = $token;
|
$attrs[$attr_name] = $token;
|
||||||
@@ -1783,6 +1780,16 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$compiled_ref = '(defined("' . substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null)';
|
$compiled_ref = '(defined("' . substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null)';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'object':
|
||||||
|
array_shift($indexes);
|
||||||
|
$compiled_ref = '$this->_reg_objects["' . substr($indexes[0],1) . '"][0]';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'objref':
|
||||||
|
array_shift($indexes);
|
||||||
|
$compiled_ref = '&$this->_reg_objects["' . substr($indexes[0],1) . '"][0]';
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$this->_syntax_error('$smarty.' . $ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
|
$this->_syntax_error('$smarty.' . $ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
|
||||||
break;
|
break;
|
||||||
|
@@ -1348,12 +1348,9 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$token = true;
|
$token = true;
|
||||||
} else if (preg_match('!^(off|no|false)$!', $token)) {
|
} else if (preg_match('!^(off|no|false)$!', $token)) {
|
||||||
$token = false;
|
$token = false;
|
||||||
} else if ($quote && preg_match('!^[\w\.-]+$!', $token)) {
|
|
||||||
/* If the token is just a string,
|
|
||||||
we double-quote it. */
|
|
||||||
$token = '"'.$token.'"';
|
|
||||||
} else if (!preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')?$!', $token)) {
|
} else if (!preg_match('!^' . $this->_obj_call_regexp . '|' . $this->_var_regexp . '(?:' . $this->_mod_regexp . ')?$!', $token)) {
|
||||||
$this->_syntax_error("invalid attribute value: '$token'", E_USER_ERROR, __FILE__, __LINE__);
|
/* treat as a string, double-quote it escaping quotes */
|
||||||
|
$token = '"'.addslashes($token).'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$attrs[$attr_name] = $token;
|
$attrs[$attr_name] = $token;
|
||||||
@@ -1783,6 +1780,16 @@ class Smarty_Compiler extends Smarty {
|
|||||||
$compiled_ref = '(defined("' . substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null)';
|
$compiled_ref = '(defined("' . substr($indexes[0],1) . '") ? ' . substr($indexes[0],1) . ' : null)';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'object':
|
||||||
|
array_shift($indexes);
|
||||||
|
$compiled_ref = '$this->_reg_objects["' . substr($indexes[0],1) . '"][0]';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'objref':
|
||||||
|
array_shift($indexes);
|
||||||
|
$compiled_ref = '&$this->_reg_objects["' . substr($indexes[0],1) . '"][0]';
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$this->_syntax_error('$smarty.' . $ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
|
$this->_syntax_error('$smarty.' . $ref . ' is an unknown reference', E_USER_ERROR, __FILE__, __LINE__);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user