Doc #80922 [Com]: Domain names are not case sensitive and should be handled accordingly
[email protected] ("julia788maxwell at gmail dot com") Fri, 30 Jun 2023 10:13:20 +0000
| Newsgroups | php.doc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=80922&edit=1
ID: 80922
Comment by: julia788maxwell at gmail dot com
Reported by: JunkYardMail1 at Frontier dot com
Summary: Domain names are not case sensitive and should be
handled accordingly
Status: Verified
Type: Documentation Problem
Package: I18N and L10N related
Operating System: FreeBSD
PHP Version: 7.4.16
Block user comment: N
Private report: N
New Comment:
Great news. (https://php.net/)(https://www.yourtexasbenefits.bid/)
Previous Comments:
------------------------------------------------------------------------
[2023-06-30 10:09:44] asfrdgtfgjh322 at gmail dot com
(https://php.net)(https://www.marykayintouch.website/)
That was so amazing.
------------------------------------------------------------------------
[2023-01-23 09:54:09] 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.
[1] www.rfc-editor.org/rfc/rfc3986#section-3.2.2
[2] www.rfc-editor.org/rfc/rfc5890
------------------------------------------------------------------------
[2021-04-06 20:17:50] JunkYardMail1 at Frontier dot com
<?php
// 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-04-06 19:31:48] 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 10:33:35] [email protected]
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
normalization.
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] <https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/uidna_8h.html#aac0ee59298161bde6220f59927249f21>
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80922
--
Edit this bug report at https://bugs.php.net/bug.php?id=80922&edit=1