Bug #80090 [NEW]: Incorrect character detection with unicode escape sequence
| From: | busuioc dot alexandru at gmail dot com | Date: | Thu, 10 Sep 2020 23:04:10 +0000 |
| Subject: | Bug #80090 [NEW]: Incorrect character detection with unicode escape sequence | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228969@lists.php.net to get a copy of this message | ||
From: busuioc dot alexandru at gmail dot com
Operating system: Alpine
PHP version: 7.4.10
Package: PCRE related
Bug Type: Bug
Bug description:Incorrect character detection with unicode escape sequence
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 bug report at https://bugs.php.net/bug.php?id=80090&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80090&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80090&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80090&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80090&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80090&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80090&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80090&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80090&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80090&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80090&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80090&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80090&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80090&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80090&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80090&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80090&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80090&r=mysqlcfg