Bug #80090 [Opn->Nab]: Incorrect character detection with unicode escape sequence

From: Date: Thu, 10 Sep 2020 23:44:33 +0000
Subject: Bug #80090 [Opn->Nab]: Incorrect character detection with unicode escape sequence
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228970@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80090&edit=1 ID: 80090 Updated by: requinix@php.net Reported by: busuioc dot alexandru at gmail dot com Summary: Incorrect character detection with unicode escape sequence -Status: Open +Status: Not a bug Type: Bug Package: PCRE related Operating System: Alpine PHP Version: 7.4.10 Block user comment: N Private report: N New Comment: Upstream bug fixed in PCRE2 10.35. https://bugs.exim.org/show_bug.cgi?id=2432 Previous Comments: ------------------------------------------------------------------------ [2020-09-10 23:04:10] busuioc dot alexandru at gmail dot com Description: ------------ PHP 7.4.9 on Alpine image --------------------- # php -m [PHP Modules] apcu blackfire Core ctype curl date dom fileinfo filter ftp gd hash iconv json libxml mbstring mcrypt memcached mongodb mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql pdo_sqlite phalcon Phar posix psr readline redis Reflection session SimpleXML sockets sodium SPL sqlite3 standard tokenizer xdebug xml xmlreader xmlwriter Zend OPcache zip zlib [Zend Modules] Xdebug Zend OPcache blackfire ------------------------- # php --ri pcre pcre PCRE (Perl Compatible Regular Expressions) Support => enabled PCRE Library Version => 10.34 2019-11-21 PCRE Unicode Version => 12.1.0 PCRE JIT Support => enabled PCRE JIT Target => x86 64bit (little endian + unaligned) Directive => Local Value => Master Value pcre.backtrack_limit => 1000000 => 1000000 pcre.recursion_limit => 100000 => 100000 pcre.jit => 1 => 1 Test script: --------------- Using '\pL' escape sequence followed by another escape sequence with a script name (e.g. \p{Arabic}) will incorrectly detect some ASCII characters (at least the "s" (the small letter)). Steps to reproduce: ``` <?php $pattern1 = '/^[0-9_\p{L}\p{Cyrillic}]+$/u'; var_dump(preg_match($pattern1, 's')); var_dump(preg_match($pattern1, 'S')); ``` The output is ``` int(0) int(1) ``` Removing the "\p{Cyrillic}" from the regex pattern above will make it return the expected output: ``` int(1) int(1) ``` Also, as a workaround, adding the "a-zA-Z" sequence in regex pattern would solve the problem. This bug can be checked here as well https://3v4l.org/bqsue ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80090&edit=1

« previous php.bugs (#228970) next »