Bug #80398 [Com]: FILTER_FLAG_EMAIL_UNICODE is not working correctly with Unicode "marks"

From: Date: Sun, 22 Nov 2020 12:09:07 +0000
Subject: Bug #80398 [Com]: FILTER_FLAG_EMAIL_UNICODE is not working correctly with Unicode "marks"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230519@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80398&edit=1 ID: 80398 Comment by: shantanoo at gmail dot com Reported by: shantanoo at gmail dot com Summary: FILTER_FLAG_EMAIL_UNICODE is not working correctly with Unicode "marks" Status: Open Type: Bug Package: Filter related Operating System: OSX 11.0.1 PHP Version: 7.4.12 Block user comment: N Private report: N New Comment: Yes, fix is works. Tested with devnagari (मराठी mr, हिन्दी hi, संस्कृत sa languages). Previous Comments: ------------------------------------------------------------------------ [2020-11-22 10:23:27] requinix@php.net Correct. The character there is म U+092E DEVANAGARI LETTER MA combined with ी U+0940 DEVANAGARI VOWEL SIGN II The latter is classified as a mark (Mc), and PHP's regex only allows letters (L) and numbers (N). If I modify the regex to include \pM then the email passes. https://3v4l.org/duYfX Can't speak to whether that modification is a valid change. Though I would think so. ------------------------------------------------------------------------ [2020-11-22 10:18:29] shantanoo at gmail dot com According to TinoDidrikse@freenode: <quote> https://github.com/php/php-src/blob/07fa13088e1349f4b5a044faeee57f2b34f6b6e4/ext/filter/logical_filters.c#L646 adds \pL\pN to allow for Unicode, for they forgot \pM for combining marks. </quote> <quote> Lack of \pM would also hit European letters like å (which is the decomposed form of å). </quote> ------------------------------------------------------------------------ [2020-11-22 09:14:54] shantanoo at gmail dot com Description: ------------ म@example.com and मी@example.com are valid emails. But FILTER_FLAG_EMAIL_UNICODE fails for later email. Test script: --------------- <?php $email = 'मी@example.com'; print filter_var($email, FILTER_VALIDATE_EMAIL, FILTER_FLAG_EMAIL_UNICODE); ?> Expected result: ---------------- Following should be printed. मी@example.com ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80398&edit=1

« previous php.bugs (#230519) next »