mirror of
https://github.com/smarty-php/smarty.git
synced 2025-07-31 16:37:14 +02:00
Fix htmlall unescape of quotes without mbstring too
This commit is contained in:
@@ -41,7 +41,7 @@ function smarty_modifiercompiler_unescape($params, Smarty_Internal_TemplateCompi
|
||||
if (Smarty::$_MBSTRING) {
|
||||
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 ] . ')';
|
||||
return 'html_entity_decode(' . $params[ 0 ] . ', ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401, ' . $params[ 2 ] . ')';
|
||||
case 'html':
|
||||
return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
|
||||
case 'url':
|
||||
|
@@ -40,8 +40,8 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
|
||||
|
||||
public function testHtmlall()
|
||||
{
|
||||
$encoded = "aäЗдра><&amp;ääвсствуйте";
|
||||
$result = "aäЗдра><&ääвсствуйте";
|
||||
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
||||
$result = "'\"aäЗдра><&ääвсствуйте";
|
||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||
}
|
||||
@@ -49,8 +49,8 @@ class PluginModifierUnescapeTest extends PHPUnit_Smarty
|
||||
public function testHtmlallWithoutMbstring()
|
||||
{
|
||||
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
|
||||
$encoded = "aäЗдра><&amp;ääвсствуйте";
|
||||
$result = "aäЗдра><&ääвсствуйте";
|
||||
$encoded = "'"aäЗдра><&amp;ääвсствуйте";
|
||||
$result = "'\"aäЗдра><&ääвсствуйте";
|
||||
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|unescape:"htmlall"}');
|
||||
$this->assertEquals($result, $this->smarty->fetch($tpl));
|
||||
Smarty::$_MBSTRING = true;
|
||||
|
Reference in New Issue
Block a user