Bug #81101 [Ver->Ana]: PCRE2 10.37 shows unexpected result
Edit report at https://bugs.php.net/bug.php?id=81101&edit=1
ID: 81101
Updated by: ab@php.net
Reported by: rlanting at move4mobile dot com
Summary: PCRE2 10.37 shows unexpected result
-Status: Verified
+Status: Analyzed
Type: Bug
Package: PCRE related
Operating System: MacOS 11.3.1
PHP Version: 8.0.6
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
Thanks for filing the upstream report. The offending commit is
https://vcs.pcre.org/pcre2?view=revision&revision=1302
It'd be still better if it were fixable on our side, as 10.37 is already out. I'll see for
that.
Thanks
Previous Comments:
------------------------------------------------------------------------
[2021-06-04 06:59:40] rlanting at move4mobile dot com
PCRE bug report: https://bugs.exim.org/show_bug.cgi?id=2763
------------------------------------------------------------------------
[2021-06-03 14:41:44] nikic@php.net
Can reproduce on master, where bundled PCRE is 10.37. It does not reproduce with -d pcre.jit=0, so
this is clearly a PCRE JIT bug.
Assigning to @ab as he did the upgrade of the bundled version, but in the end this will need an
upstream report and fix.
------------------------------------------------------------------------
[2021-06-03 14:40:21] Danack at basereality dot com
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.
------------------------------------------------------------------------
[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)