php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80834 The idn_to_utf8 function returns an error when the URL has "-" at the end
Submitted: 2021-03-05 08:20 UTC Modified: 2021-03-05 10:30 UTC
From: kontakt at jinteractive dot pl Assigned: cmb (profile)
Status: Not a bug Package: *URL Functions
PHP Version: 7.4.16 OS: Windows, Centos
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kontakt at jinteractive dot pl
New email:
PHP Version: OS:

 

 [2021-03-05 08:20 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-03-05 10:30 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-03-05 10:30 UTC] cmb@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC