Skip to content

Commit 9934026

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Mangle PCRE regex cache key with JIT option
2 parents 0f3e8ef + 34a1a1b commit 9934026

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ext/pcre/php_pcre.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,24 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
612612
pcre_cache_entry *ret;
613613

614614
if (locale_aware && BG(ctype_string)) {
615-
key = zend_string_concat2(
615+
key = zend_string_concat3(
616616
ZSTR_VAL(BG(ctype_string)), ZSTR_LEN(BG(ctype_string)),
617-
ZSTR_VAL(regex), ZSTR_LEN(regex));
617+
ZSTR_VAL(regex), ZSTR_LEN(regex),
618+
#ifdef HAVE_PCRE_JIT_SUPPORT
619+
PCRE_G(jit) ? "1" : "0", 1
620+
#else
621+
"", 0
622+
#endif
623+
);
618624
} else {
625+
#ifdef HAVE_PCRE_JIT_SUPPORT
626+
key = zend_string_concat2(
627+
ZSTR_VAL(regex), ZSTR_LEN(regex),
628+
PCRE_G(jit) ? "1" : "0", 1
629+
);
630+
#else
619631
key = regex;
632+
#endif
620633
}
621634

622635
/* Try to lookup the cached regex entry, and if successful, just pass
@@ -770,7 +783,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
770783
return NULL;
771784
}
772785

773-
if (key != regex) {
786+
if (locale_aware && BG(ctype_string)) {
774787
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(ctype_string));
775788
if (!tables) {
776789
zend_string *_k;

0 commit comments

Comments
 (0)