Bug #81101 [Opn]: PCRE2 10.37 shows unexpected result

From: Date: Thu, 03 Jun 2021 14:25:48 +0000
Subject: Bug #81101 [Opn]: PCRE2 10.37 shows unexpected result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234187@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81101&edit=1 ID: 81101 User updated by: rlanting at move4mobile 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 an additional note, I tried reproducing with the pcre2test binary but couldn't get it to break with that. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#234187) next »