pcre: various minor refactorings (2026-09 N1) - #23536
Draft
Girgias wants to merge 7 commits into
Draft
Conversation
Instead of a const char*, size_t pair
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)
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.