Skip to content

Commit 68b26ff

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents 9004102 + 736af5f commit 68b26ff

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
@@ -565,7 +565,7 @@ static zend_always_inline size_t calculate_unit_length(pcre_cache_entry *pce, ch
565565

566566
/* {{{ pcre_get_compiled_regex_cache
567567
*/
568-
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
568+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware)
569569
{
570570
pcre2_code *re = NULL;
571571
uint32_t coptions = 0;
@@ -587,7 +587,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
587587
zend_string *key;
588588
pcre_cache_entry *ret;
589589

590-
if (BG(locale_string) &&
590+
if (locale_aware && BG(locale_string) &&
591591
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
592592
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
593593
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
@@ -879,6 +879,14 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
879879
}
880880
/* }}} */
881881

882+
/* {{{ pcre_get_compiled_regex_cache
883+
*/
884+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
885+
{
886+
return pcre_get_compiled_regex_cache_ex(regex, 1);
887+
}
888+
/* }}} */
889+
882890
/* {{{ pcre_get_compiled_regex
883891
*/
884892
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
@@ -40,6 +40,7 @@ extern zend_module_entry pcre_module_entry;
4040
typedef struct _pcre_cache_entry pcre_cache_entry;
4141

4242
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
43+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
4344

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

0 commit comments

Comments
 (0)