Bug #81101 [Com]: PCRE2 10.37 shows unexpected result
Edit report at https://bugs.php.net/bug.php?id=81101&edit=1
ID: 81101
Comment by: Danack at basereality dot com
Reported by: rlanting at move4mobile dot com
Summary: PCRE2 10.37 shows unexpected result
Status: Open
Type: Bug
Package: PCRE related
Operating System: MacOS 11.3.1
PHP Version: 8.0.6
Block user comment: N
Private report: N
New Comment:
As a simple thing to check, please could you set ini_set("pcre.jit", "0"); to
see if that makes any difference on the broken version.
Previous Comments:
------------------------------------------------------------------------
[2021-06-03 14:25:48] rlanting at move4mobile dot com
As an additional note, I tried reproducing with the pcre2test binary but couldn't get it to
break with that.
------------------------------------------------------------------------
[2021-06-03 14:19:56] rlanting at move4mobile dot com
Description:
------------
This week I updated php and pcre through homebrew. As a result I got pcre2 10.37. For that specific
version preg_match doesn't work as expected. Reverting only pcre2 to 10.36 makes it work again.
The regex originates from https://github.com/phpspec/phpspec/blob/eb0d939b235f6091a8439a2a2fc144c9e0d5f569/src/PhpSpec/CodeAnalysis/TokenizedNamespaceResolver.php#L119
Homebrew issue: https://github.com/Homebrew/homebrew-core/issues/78635
Test script:
---------------
<?php
$matches = [];
$test = ' App\Domain\Repository\MetaData\SomethingRepositoryInterface';
preg_match('/\\\\([^\\\\]+)\s*$/', $test, $matches);
var_dump($matches);
$test2 = ' App\Domain\Exception\NotFoundException';
preg_match('/\\\\([^\\\\]+)\s*$/', $test2, $matches);
var_dump($matches);
Expected result:
----------------
array(2) {
[0]=>
string(29) "\SomethingRepositoryInterface"
[1]=>
string(28) "SomethingRepositoryInterface"
}
array(2) {
[0]=>
string(18) "\NotFoundException"
[1]=>
string(17) "NotFoundException"
}
Actual result:
--------------
array(0) {
}
array(2) {
[0]=>
string(18) "\NotFoundException"
[1]=>
string(17) "NotFoundException"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81101&edit=1
Thread (10 messages)