mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-03 01:44:26 +02:00
PHP8.2 compatibility : Remove HTML-ENTITIES parameter
This commit is contained in:
@@ -90,7 +90,9 @@ function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $
|
||||
}
|
||||
}
|
||||
// htmlentities() won't convert everything, so use mb_convert_encoding
|
||||
return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);
|
||||
$string = mb_convert_encoding($string, 'UTF-8', $char_set);
|
||||
$string = htmlentities($string);
|
||||
return htmlspecialchars_decode($string);
|
||||
}
|
||||
// no MBString fallback
|
||||
if ($_double_encode) {
|
||||
|
@@ -39,7 +39,7 @@ function smarty_modifiercompiler_unescape($params, Smarty_Internal_TemplateCompi
|
||||
case 'entity':
|
||||
case 'htmlall':
|
||||
if (Smarty::$_MBSTRING) {
|
||||
return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
|
||||
return 'html_entity_decode(mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'UTF-8\'), ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
||||
}
|
||||
return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
|
||||
case 'html':
|
||||
|
@@ -30,7 +30,7 @@ class PluginModifierStripTest extends PHPUnit_Smarty
|
||||
{
|
||||
// Some Unicode Spaces
|
||||
$string = " hello spaced       words ";
|
||||
$string = mb_convert_encoding($string, 'UTF-8', "HTML-ENTITIES");
|
||||
$string = html_entity_decode($string, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, 'UTF-8');
|
||||
$tpl = $this->smarty->createTemplate('string:{"' . $string . '"|strip}');
|
||||
$this->assertEquals(" hello spaced words ", $this->smarty->fetch($tpl));
|
||||
}
|
||||
|
Reference in New Issue
Block a user