|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-01-27 15:20 UTC] php at spamscan dot biz
Description:
------------
When using preg_match() to check against PCRE character properties, using different character properties, where one is \p{N}, the match fails.
I've provided a short sample script with this bug report.
A more thorough script that shows that the problem only occurs if \p{N} is combined with other character properties can be found here:
https://3v4l.org/XFEue
$> /opt/php/bin/php --info|grep configure
Configure Command => './configure' '--prefix=/opt/php' '--exec-prefix=/opt/php' '--with-mysqli=mysqlnd' '--with-pear' '--enable-gd' '--with-freetype' '--with-zlib-dir=/usr/lib' '--with-config-file-path=/etc/' '--with-jpeg' '--with-openssl' '--with-curl' '--enable-mbstring' '--with-zip' '--enable-sockets' '--enable-phar' '--enable-pcntl' '--enable-intl' '--without-sqlite3' '--without-pdo-sqlite'
It seems that this is not an PCRE problem. I've tested the regexp with PCRE2 v.10.33 (the one that comes bundled with php 7.4.2):
$> ./pcre2test
PCRE2 version 10.33 2019-04-16
re> /[\p{Latin}\p{N}]+/
data> Text1234567890Text
0: Text1234567890Text
Test script:
---------------
<?php
$string = 'Text1234567890Text';
print_r(preg_match('/[\p{Latin}\p{N}]+/u', $string, $m));
echo "\n---\n";
print_r($m);
Expected result:
----------------
excpected result (php version 7.3)
$> php --version
PHP 7.3.12 (cli) (built: Nov 28 2019 10:53:41) ( NTS )
test script output:
1
---
Array
(
[0] => Text1234567890Text
)
Actual result:
--------------
actual result (php 7.4)
$> php --version
PHP 7.4.2 (cli) (built: Jan 27 2020 14:05:08) ( NTS )
test script output:
1
---
Array
(
[0] => Text
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 23:00:02 2025 UTC |
yes, thats seems to be the problem: $> ./pcre2test -jit PCRE2 version 10.33 2019-04-16 re> /[\p{Latin}\p{N}]+/ data> Text1234567890Text 0: Text $> ./pcre2test PCRE2 version 10.33 2019-04-16 re> /[\p{Latin}\p{N}]+/ data> Text1234567890Text 0: Text1234567890Text data>$> ./pcre2test -jit PCRE2 version 10.34 2019-11-21 re> /[\p{Latin}\p{N}]+/ data> Text1234567890Text 0: Text $> ./pcre2test PCRE2 version 10.34 2019-11-21 re> /[\p{Latin}\p{N}]+/ data> Text1234567890Text 0: Text1234567890Text still not working in v.10.43