php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hpwesterlund at gmail dot com
New email:
PHP Version: OS:

 

 [2018-08-23 14:48 UTC] hpwesterlund at gmail dot com
Description:
------------
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---0.dk', 0, INTL_IDNA_VARIANT_UTS46));

Expected result:
----------------
string '0---0.dk'

Actual result:
--------------
boolean false

Patches

Pull Requests

History

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] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-08-23 15:06 UTC] cmb@php.net
Is this really about the PECL extension, or is it about the
bundled intl extension?
 [2018-08-23 16:50 UTC] requinix@php.net
-Status: Feedback +Status: Not a bug -Assigned To: cmb +Assigned To:
 [2018-08-23 16:50 UTC] requinix@php.net
UTS#46 does not allow labels with hyphens in the 3rd and 4th positions.
https://unicode.org/reports/tr46/#Validity_Criteria

The fourth argument to idn_to_ascii would have given you

array(3) {
  ["result"]=>
  string(8) "0---0.dk"
  ["isTransitionalDifferent"]=>
  bool(false)
  ["errors"]=>
  int(32)
}

The error IDNA_ERROR_HYPHEN_3_4.

Meanwhile the domain name 000---0.dk 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: Sat Dec 21 13:01:31 2024 UTC