Bug #73251 [Ver->Nab]: [а-я] range contains not all cyrillic letters, filtar_var() fails for valid st

From: Date: Wed, 05 Oct 2016 11:49:09 +0000
Subject: Bug #73251 [Ver->Nab]: [а-я] range contains not all cyrillic letters, filtar_var() fails for valid st
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204473@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73251&edit=1 ID: 73251 Updated by: cmb@php.net Reported by: ikonta at yandex dot ru Summary: [а-я] range contains not all cyrillic letters, filtar_var() fails for valid st -Status: Verified +Status: Not a bug Type: Bug -Package: Filter related +Package: PCRE related Operating System: Linux PHP Version: 5.6.26 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: Actually, this is rather an issue with the Unicode layout. Ё (U+0401) comes before А (U+0410), so it is rightly not considered to be part of the range [А-Я]. Previous Comments: ------------------------------------------------------------------------ [2016-10-05 11:40:27] cmb@php.net I can confirm the behavior which is, however, not particularly related to ext/filter, but rather is a general issue of PCRE, see <https://3v4l.org/oBqFi>. Quite likely that is an issue of libpcre and not the PHP bindings, though. ------------------------------------------------------------------------ [2016-10-05 11:01:05] ikonta at yandex dot ru Description: ------------ Modern Russian alphabet contains 33 letters. Standard UTF8 rage covers 32 of most common, but misses one ('ё'). Standard U+0410 А … U+044F я Exceptions: U+0401 Ё U+0451 ё http://www.utf8-chartable.de/unicode-utf8-table.pl?start=1024 [а-я] range should include 'ё' (and [А-Я] — 'Ё') letter, but actually do not. Test script: --------------- $ cat cyr_io.php <?php $str = "еще"; $valid_string_expr = '/(*UTF8)[^а-я]/'; if (filter_var($str, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"$valid_string_expr"))) === FALSE) echo ("string contains only cyrillic small letters\n"); else echo ("string contains NOT only cyrillic small letters\n"); $str = "ещё"; if (filter_var($str, FILTER_VALIDATE_REGEXP, array("options"=>array("regexp"=>"$valid_string_expr"))) === FALSE) echo ("string contains only cyrillic small letters\n"); else echo ("string contains NOT only cyrillic small letters\n"); ?> Expected result: ---------------- $ php cyr_io.php string contains only cyrillic small letters string contains only cyrillic small letters Actual result: -------------- $ php cyr_io.php string contains only cyrillic small letters string contains NOT only cyrillic small letters ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73251&edit=1

« previous php.bugs (#204473) next »