From aece622c98db69b26486a4b921c9198d7de2bbbb Mon Sep 17 00:00:00 2001
From: Andreas Fernandez <a.fernandez@scripting-base.de>
Date: Mon, 20 Dec 2021 15:26:23 +0100
Subject: [PATCH] [BUGFIX] Remove useless string cast of idn_to_ascii()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The function `idn_to_ascii()` will return either `false` or a string,
the former one is returned on errors. In #93900, the result was cast to
string, making the check for `false` useless.

As `idn_to_ascii()` can return both, the string cast is removed to make
the check for `false` functional again.

Resolves: #96399
Related: #93900
Releases: main, 11.5
Change-Id: Ib5327766fc545a75feb7389d18358aa85b76e5db
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72740
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Nikita Hovratov <nikita.h@live.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Oliver Bartsch <bo@cedev.de>
---
 typo3/sysext/core/Classes/Utility/GeneralUtility.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
index 089dc693ae73..2e0eedf444fa 100644
--- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php
+++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php
@@ -818,7 +818,7 @@ class GeneralUtility
             return false;
         }
         if (isset($parsedUrl['host']) && !preg_match('/^[a-z0-9.\\-]*$/i', $parsedUrl['host'])) {
-            $host = (string)idn_to_ascii($parsedUrl['host']);
+            $host = idn_to_ascii($parsedUrl['host']);
             if ($host === false) {
                 return false;
             }
-- 
GitLab