Fixed second param of unescape modifier (#778)

Fixes #777
This commit is contained in:
Simon Wisselink
2022-08-01 23:49:19 +02:00
committed by GitHub
parent 20a8026ccd
commit f4b26a3cbf
3 changed files with 23 additions and 9 deletions
+15 -7
View File
@@ -14,20 +14,28 @@
* @author Rodney Rehm
*
* @param array $params parameters
* @param Smarty_Internal_TemplateCompilerBase $compiler
*
* @return string with compiled code
*/
function smarty_modifiercompiler_unescape($params)
function smarty_modifiercompiler_unescape($params, Smarty_Internal_TemplateCompilerBase $compiler)
{
if (!isset($params[ 1 ])) {
$params[ 1 ] = 'html';
}
$compiler->template->_checkPlugins(
array(
array(
'function' => 'smarty_literal_compiler_param',
'file' => SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php'
)
)
);
$esc_type = smarty_literal_compiler_param($params, 1, 'html');
if (!isset($params[ 2 ])) {
$params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
} else {
$params[ 2 ] = "'{$params[ 2 ]}'";
}
switch (trim($params[ 1 ], '"\'')) {
switch ($esc_type) {
case 'entity':
case 'htmlall':
if (Smarty::$_MBSTRING) {