|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80922 Domain names are not case sensitive and should be handled accordingly
Submitted: 2021-03-31 01:23 UTC Modified: 2021-11-11 11:59 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: JunkYardMail1 at Frontier dot com Assigned:
Status: Verified Package: I18N and L10N related
PHP Version: 7.4.16 OS: FreeBSD
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: JunkYardMail1 at Frontier dot com
New email:
PHP Version: OS:


 [2021-03-31 01:23 UTC] JunkYardMail1 at Frontier dot com
From manual page:
"This function converts a Unicode domain name to an IDNA ASCII-compatible format."

Clearly '' is not a "Unicode domain name" and thus it should not be altered.  But it is altered.  It is forced to lower case.

idn_to_ascii() and idn_to_utf8() functions force domain names to lower case.  Even non IDN domain names are forced to lower case.

Domain names are not case sensitive and thus their case should not be altered from what is passed to the functions.  Case should be retained as it is provided.

Test script:
echo 'Non IDN:' . "\n";
echo 'idn_to_ascii(\'\');' . "\n";
echo '  Expected result:' . "\n";
echo '    Actual result: ' . idn_to_ascii('') . "\n\n";

echo 'idn_to_utf8(\'\');' . "\n";
echo '  Expected result:' . "\n";
echo '    Actual result: ' . idn_to_utf8('') . "\n\n";

echo 'IDN:' . "\n";
echo 'idn_to_ascii(\'Tä\');' . "\n";
echo '  Expected result:' . "\n";
echo '    Actual result: ' . idn_to_ascii('Tä') . "\n\n";

echo 'idn_to_utf8(\'\');' . "\n";
echo '  Expected result: Tä' . "\n";
echo '    Actual result: ' . idn_to_utf8('') . "\n\n";

Expected result:
# Non IDN:

# IDN:

Actual result:
# Non IDN:

# IDN:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-04-06 10:33 UTC]
-Status: Open +Status: Verified -Type: Feature/Change Request +Type: Documentation Problem
 [2021-04-06 10:33 UTC]
idn_to_ascii() is a relatively simple wrapper of
uidna_nameToASCII_UTF8(), which is documented[1] as:

| Converts a whole domain name into its ASCII form for DNS lookup.

So the PHP documentation isn't quite right.  The fact that the
function returns the lower cased domain name, is just part of the

I don't think it makes sense to change that behavior; if you don't
want the lower casing for ASCII domain names, just don't pass
these to idn_to_ascii().

[1] <>
 [2021-04-06 19:31 UTC] JunkYardMail1 at Frontier dot com
The issue is broader than just not passing ASCII domain names.

It also affects unicode domain names.  These need to be converted to ASCII IDN for DNS usage.  But should retain their original case as that is what the human input intended, as these are sometimes stored and redisplayed for human consumption as the ASCII IDN or as the original unicode, and should be presented case unchanged.
 [2021-04-06 20:17 UTC] JunkYardMail1 at Frontier dot com
// This works to prevent forcing lowercase of ASCII domain names.
// But not does not work to prevent forcing lowercase of Unicode domain names.

if (($idn = idn_to_ascii($domain_name)) === strtolower($domain_name)) {
	// Use the original $domain_name
} else {
	// Use the converted $idn
 [2021-11-11 11:59 UTC]
-Package: idn +Package: I18N and L10N related
 [2023-01-23 09:54 UTC] jules dot bernable at gmail dot com
RFC3986 section 3.2.2[1] clearly states that the host component of a URI is case-insensitive.

The idn_to_ascii function uses ICU's uidna_nameToASCII, whose purpose is to encode domain names in the format defined in RFC5890[2], to allow robust case-insensitive comparison of IDNs.

Therefore, I think this bug is invalid.

 [2023-06-30 10:09 UTC] asfrdgtfgjh322 at gmail dot com

That was so amazing.
 [2023-06-30 10:13 UTC] julia788maxwell at gmail dot com
Great news. (
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 03:01:28 2024 UTC