PHP8.2 compatibility : Remove deprecated utf8_decode

This commit is contained in:
Progi1984
2022-09-19 09:32:41 +02:00
parent 87c479c87e
commit afbcf3250d
3 changed files with 6 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
public function testToLatin1()
{
$encoded = "hällö wörld 1";
$result = utf8_decode($encoded);
$result = mb_convert_encoding($encoded, 'ISO-8859-1', 'UTF-8');
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
}
@@ -33,7 +33,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
Smarty::$_MBSTRING = false;
$this->smarty->setCompileId('mb');
$encoded = "hällö wörld 2";
$result = utf8_decode($encoded);
$result = mb_convert_encoding($encoded, 'ISO-8859-1', 'UTF-8');
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|to_charset}');
$this->assertEquals($encoded, $tpl->fetch());
Smarty::$_MBSTRING = true;
@@ -42,7 +42,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
public function testFromLatin1()
{
$result = "hällö wörld 3";
$encoded = utf8_decode($result);
$encoded = mb_convert_encoding($result, 'ISO-8859-1', 'UTF-8');
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
$this->assertEquals(str_replace("\r", '', $result), $tpl->fetch());
}
@@ -52,7 +52,7 @@ class PluginModifierCharsetTest extends PHPUnit_Smarty
Smarty::$_MBSTRING = false;
$this->smarty->setCompileId('mb');
$result = "hällö wörld 4";
$encoded = utf8_decode($result);
$encoded = mb_convert_encoding($result, 'ISO-8859-1', 'UTF-8');
$tpl = $this->smarty->createTemplate('string:{"' . $encoded . '"|from_charset}');
$this->assertEquals($encoded, $tpl->fetch());
Smarty::$_MBSTRING = true;

View File

@@ -203,7 +203,7 @@ class PluginModifierEscapeTest extends PHPUnit_Smarty
public function testNonstdWithoutMbstring()
{
Smarty::$_MBSTRING = false;$this->smarty->setCompileId('mb');
$tpl = $this->smarty->createTemplate('string:{"' . utf8_decode('sma\'rty@»example«.com') . '"|escape:"nonstd"}');
$tpl = $this->smarty->createTemplate('string:{"' . mb_convert_encoding('sma\'rty@»example«.com', 'ISO-8859-1', 'UTF-8') . '"|escape:"nonstd"}');
$this->assertEquals("sma'rty@»example«.com", $this->smarty->fetch($tpl));
Smarty::$_MBSTRING = true;
}

View File

@@ -68,6 +68,7 @@ class StreamVariableTest extends PHPUnit_Smarty
// }
}
#[AllowDynamicProperties]
class VariableStream
{
private $position;