Bug #80855 [Nab]: FILTER_VALIDATE_DOMAIN does not recognize emoji TLDs with FILTER_FLAG_HOSTNAME

From: Date: Thu, 11 Mar 2021 20:22:15 +0000
Subject: Bug #80855 [Nab]: FILTER_VALIDATE_DOMAIN does not recognize emoji TLDs with FILTER_FLAG_HOSTNAME
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232659@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80855&edit=1 ID: 80855 User updated by: vijaycs85 at gmail dot com Reported by: vijaycs85 at gmail dot com Summary: FILTER_VALIDATE_DOMAIN does not recognize emoji TLDs with FILTER_FLAG_HOSTNAME Status: Not a bug Type: Bug Package: Filter related Operating System: OSX PHP Version: 7.4.16 Block user comment: N Private report: N New Comment: >Note that ⚡.kz must be converted to punycode, ie. xn--57h.kz. That would be considered >valid with the HOSTNAME flag. Thanks for your quick reply and clarification. Previous Comments: ------------------------------------------------------------------------ [2021-03-11 20:10:08] requinix@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php https://www.php.net/manual/en/filter.filters.validate.php > Optional flag FILTER_FLAG_HOSTNAME adds ability to specifically validate > hostnames (they must start with an alphanumeric character and contain only > alphanumerics or hyphens). Note that ⚡.kz must be converted to punycode, ie. xn--57h.kz. That would be considered valid with the HOSTNAME flag. ------------------------------------------------------------------------ [2021-03-11 19:54:24] vijaycs85 at gmail dot com Description: ------------ There are some countries that allow Top Level Domains(TLDs) with emoji and the filter_var does not recognize them. Reference: https://tinyprojects.dev/projects/mailoji Test script: --------------- $domain_name = '⚡.kz'; $is_valid = filter_var($domain_name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME); var_dump($is_valid); Expected result: ---------------- string(4) "⚡.kz" Actual result: -------------- bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80855&edit=1

« previous php.bugs (#232659) next »