|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76784 idn_to_ascii with UTF46 variant returns false on a string containing 3 dashes
Submitted: 2018-08-23 14:48 UTC Modified: 2018-08-24 07:46 UTC
From: hpwesterlund at gmail dot com Assigned:
Status: Not a bug Package: idn (PECL)
PHP Version: 7.2.1 OS: linux
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.
Block user comment
Status: Assign to:
Bug Type:
From: hpwesterlund at gmail dot com
New email:
PHP Version: OS:


 [2018-08-23 14:48 UTC] hpwesterlund at gmail dot com
Using PHP 7.2.1 on Ubuntu calling idn_to_ascii with a domain name with three dashes and the variant INTL_IDNA_VARIANT_UTS46, the function returns a boolean false.

Test script:
var_dump(idn_to_ascii('', 0, INTL_IDNA_VARIANT_UTS46));

Expected result:
string ''

Actual result:
boolean false


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-23 14:49 UTC] hpwesterlund at gmail dot com
-PHP Version: 7.2.9 +PHP Version: 7.2.1
 [2018-08-23 14:49 UTC] hpwesterlund at gmail dot com
fixed version
 [2018-08-23 15:06 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-08-23 15:06 UTC]
Is this really about the PECL extension, or is it about the
bundled intl extension?
 [2018-08-23 16:50 UTC]
-Status: Feedback +Status: Not a bug -Assigned To: cmb +Assigned To:
 [2018-08-23 16:50 UTC]
UTS#46 does not allow labels with hyphens in the 3rd and 4th positions.

The fourth argument to idn_to_ascii would have given you

array(3) {
  string(8) ""

The error IDNA_ERROR_HYPHEN_3_4.

Meanwhile the domain name is acceptable.
 [2018-08-24 07:46 UTC] hpwesterlund at gmail dot com
Cool beans, thanks. Great to know.

As these are valid domain names it does however make the direct way that most packages use this function error prone. For our use they will always have be wrapped in a conditional to handle these.

I'll hopefully be looking forward to support for controlling the CheckHyphens option being added, i.e. bug#76658.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jul 14 17:01:28 2024 UTC