Bug #80834 [Opn->Nab]: The idn_to_utf8 function returns an error when the URL has "-" at the end
| From: | cmb@php.net | Date: | Fri, 05 Mar 2021 10:30:43 +0000 |
| Subject: | Bug #80834 [Opn->Nab]: The idn_to_utf8 function returns an error when the URL has "-" at the end | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232572@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80834&edit=1
ID: 80834
Updated by: cmb@php.net
Reported by: kontakt at jinteractive dot pl
Summary: The idn_to_utf8 function returns an error when the
URL has "-" at the end
-Status: Open
+Status: Not a bug
Type: Bug
Package: *URL Functions
Operating System: Windows, Centos
PHP Version: 7.4.16
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Trailing hyphens are not allowed for INTL_IDNA_VARIANT_UTS46, what
is the default as of PHP 7.4.0. If you had passed an $idna_info
and checked its 'errors' element, you had gotten 16, which is
IDNA_ERROR_TRAILING_HYPHEN.
Also note that idn_to_utf8() expects a domain name, not an URL.
Previous Comments:
------------------------------------------------------------------------
[2021-03-05 08:20:45] kontakt at jinteractive dot pl
Description:
------------
The idn_to_utf8 function returns an error when the URL has a "-" sign at the end.
Test script:
---------------
$x = idn_to_utf8('www.website.com/asa-asda-asd-.html');
if (!$x)
echo 'error';
else
echo $x;
//return error
$x = idn_to_utf8('www.website.com/asa-asda-asd-');
if (!$x)
echo 'error';
else
echo $x;
//return error
$x = idn_to_utf8('www.website.com/asa-asda-asd.html');
if (!$x)
echo 'error';
else
echo $x;
// return url
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80834&edit=1