Commit 63e2de04 authored by Stefan Bürk's avatar Stefan Bürk
Browse files

[TASK] Avoid deprecated `utf_decode()` method in tests

With PHP 8.2 old and unreliable methods `utf8_encode()`
and `utf8_decode()` have been deprecated and will be
removed in PHP 9.0.

There are several ways to replace these methods, although
none of them are "ensured" to be native enabled in PHP.

We need to replace these methods in tests only, and as
we have testing setup fully under control, this patch
use `mb_convert_encoding()` from php extension `mbstring`
to avoid deprecated methods and corresponding native php
deprecation messages in functional test.

Resolves: #98038
Releases: main, 11.5
Change-Id: I8a70a203eeae6a314e30cedab8668541145ef6c3
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/75312

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Oliver Klee's avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
parent 821e8964
......@@ -85,7 +85,7 @@ class HtmlentitiesDecodeViewHelperTest extends FunctionalTestCase
*/
public function renderRespectsEncodingArgument(): void
{
$source = utf8_decode('Some special characters: &amp; &quot; \' &lt; &gt; *');
$source = 'Some special characters: &amp; &quot; \' &lt; &gt; *';
$expectedResult = 'Some special characters: & " \' < > *';
$context = $this->get(RenderingContextFactory::class)->create();
$context->getTemplatePaths()->setTemplateSource('<f:format.htmlentitiesDecode encoding="ISO-8859-1">' . $source . '</f:format.htmlentitiesDecode>');
......
......@@ -85,7 +85,7 @@ class HtmlentitiesViewHelperTest extends FunctionalTestCase
*/
public function renderRespectsEncodingArgument(): void
{
$source = utf8_decode('Some special characters: &©"\'');
$source = mb_convert_encoding('Some special characters: &©"\'', 'ISO-8859-1', 'UTF-8');
$expectedResult = 'Some special characters: &amp;&copy;&quot;&#039;';
$context = $this->get(RenderingContextFactory::class)->create();
$context->getTemplatePaths()->setTemplateSource('<f:format.htmlentities encoding="ISO-8859-1">' . $source . '</f:format.htmlentities>');
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment