Conversation
devnexen
reviewed
Sep 2, 2026
|
|
||
| if (key != regex) { | ||
| zv = zend_hash_str_lookup(&char_tables, ZSTR_VAL(BG(ctype_string)), ZSTR_LEN(BG(ctype_string))); | ||
| zv = zend_hash_lookup(&char_tables, BG(ctype_string)); |
Member
There was a problem hiding this comment.
this is the only change that concerns me a bit. would it be possible to try at least locally this change (with ASAN) ?
❯ can you draft a test to trigger this issue ?zm_globals_dtor_pcre → zend_hash_destroy(&char_tables)).
--TEST--
preg_match(): locale-keyed char tables cache must not borrow a request-lifetime key
--SKIPIF--
<?php
if (setlocale(LC_CTYPE, 'C.UTF-8', 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8') === false) {
die('skip no suitable non-C locale available');
}
?>
--FILE--
<?php
var_dump(setlocale(LC_CTYPE, 'C.UTF-8', 'en_US.UTF-8', 'en_US.utf8', 'de_DE.UTF-8', 'de_DE.utf8') !== false);
setlocale(LC_CTYPE, setlocale(LC_CTYPE, 0));
var_dump(preg_match('/[[:alpha:]]/', 'a'));
?>
--EXPECT--
bool(true)
int(1)
Member
Author
There was a problem hiding this comment.
Was already covered by ext/pcre/tests/bug76850.phpt and it does indeed cause issues.
Girgias
force-pushed
the
2026-09-pcre-minor-refactoring
branch
from
September 23, 2026 01:31
4554b1a to
37ade72
Compare
Girgias
marked this pull request as ready for review
September 23, 2026 01:32
devnexen
reviewed
Sep 23, 2026
| @@ -2924,12 +2916,9 @@ PHP_FUNCTION(preg_grep) | |||
|
|
|||
| PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return_value, zend_long flags) /* {{{ */ | |||
Member
There was a problem hiding this comment.
I m almost certain you ll agree :) but I think pce can be const here (php_pcre_replace_impl too), wdyt ?
devnexen
approved these changes
Sep 23, 2026
devnexen
left a comment
Member
There was a problem hiding this comment.
aside from the little nit, lgtm
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.