Skip to content

Commit 736af5f

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 9fd555f + a8f60ac commit 736af5f

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

528528
/* {{{ pcre_get_compiled_regex_cache
529529
*/
530-
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
530+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware)
531531
{
532532
pcre2_code *re = NULL;
533533
uint32_t coptions = 0;
@@ -552,7 +552,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
552552
pcre_cache_entry *ret;
553553

554554
#if HAVE_SETLOCALE
555-
if (BG(locale_string) &&
555+
if (locale_aware && BG(locale_string) &&
556556
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
557557
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
558558
memcpy(ZSTR_VAL(key), ZSTR_VAL(BG(locale_string)), ZSTR_LEN(BG(locale_string)) + 1);
@@ -867,6 +867,14 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
867867
}
868868
/* }}} */
869869

870+
/* {{{ pcre_get_compiled_regex_cache
871+
*/
872+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
873+
{
874+
return pcre_get_compiled_regex_cache_ex(regex, 1);
875+
}
876+
/* }}} */
877+
870878
/* {{{ pcre_get_compiled_regex
871879
*/
872880
PHPAPI pcre2_code *pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options)

ext/pcre/php_pcre.h

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

4646
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
47+
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
4748

4849
PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, size_t subject_len, zval *return_value,
4950
zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset);

0 commit comments

Comments
 (0)