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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2021 The PHP Group
All rights reserved.
Last updated: Sat Sep 25 04:03:37 2021 UTC