-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The way to fix it is to disable certain match start optimizaions. The observed performance impact appears negligible ATM, compared to the functional regression revealed. A possible side effect might occur if a pattern uses (*COMMIT) or (*MARK), which is however not a very broadly used syntax in PHP. Still this should be observed and handled by possibly adding a possibility to reverse PCRE2_NO_START_OPTIMIZE on the user side. One test shows a behavior change, where instead of int 0 the match would produce an error and return false. Except strict comparison is used, this should be acceptable. Signed-off-by: Anatol Belski <ab@php.net> (cherry picked from commit d188ca7) Signed-off-by: Anatol Belski <ab@php.net>
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--TEST-- | ||
Bug #81101 - Invalid single character repetition issues in JIT | ||
--FILE-- | ||
<?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); | ||
|
||
?> | ||
--EXPECT-- | ||
array(2) { | ||
[0]=> | ||
string(29) "\SomethingRepositoryInterface" | ||
[1]=> | ||
string(28) "SomethingRepositoryInterface" | ||
} | ||
array(2) { | ||
[0]=> | ||
string(18) "\NotFoundException" | ||
[1]=> | ||
string(17) "NotFoundException" | ||
} |