Skip to content

Commit 571a3bf

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 31c3b0c + 68b26ff commit 571a3bf

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

ext/pcre/php_pcre.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ static zend_always_inline size_t calculate_unit_length(pcre_cache_entry *pce, ch
556556

557557
/* {{{ pcre_get_compiled_regex_cache
558558
*/
559-
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
559+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware)
560560
{
561561
pcre2_code *re = NULL;
562562
uint32_t coptions = 0;
@@ -577,7 +577,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
577577
zend_string *key;
578578
pcre_cache_entry *ret;
579579

580-
if (BG(locale_string) &&
580+
if (locale_aware && BG(locale_string) &&
581581
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
582582
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
583583
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
@@ -858,6 +858,14 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
858858
}
859859
/* }}} */
860860

861+
/* {{{ pcre_get_compiled_regex_cache
862+
*/
863+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
864+
{
865+
return pcre_get_compiled_regex_cache_ex(regex, 1);
866+
}
867+
/* }}} */
868+
861869
/* {{{ pcre_get_compiled_regex
862870
*/
863871
PHPAPI pcre2_code *pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count)

ext/pcre/php_pcre.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ extern zend_module_entry pcre_module_entry;
3838
typedef struct _pcre_cache_entry pcre_cache_entry;
3939

4040
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
41+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
4142

4243
PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
4344
zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset);

0 commit comments

Comments
 (0)