summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-10-08 16:13:17 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-10-08 16:13:17 +0200
commit736af5f6602145a267dcd9d795414a6dbffa07dc (patch)
treeea27c0e24fa992730ab9c19892423ec8c6376b88
parent9fd555f99e3385e91a65b6145eb403908a629759 (diff)
parenta8f60ac9dd3ba8fed24370799603b92487fdf362 (diff)
downloadphp-git-736af5f6602145a267dcd9d795414a6dbffa07dc.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
-rw-r--r--ext/pcre/php_pcre.c12
-rw-r--r--ext/pcre/php_pcre.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 59217349b5..e82dc252b2 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -527,7 +527,7 @@ static zend_always_inline size_t calculate_unit_length(pcre_cache_entry *pce, ch
/* {{{ pcre_get_compiled_regex_cache
*/
-PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
+PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware)
{
pcre2_code *re = NULL;
uint32_t coptions = 0;
@@ -552,7 +552,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
pcre_cache_entry *ret;
#if HAVE_SETLOCALE
- if (BG(locale_string) &&
+ if (locale_aware && BG(locale_string) &&
(ZSTR_LEN(BG(locale_string)) != 1 && ZSTR_VAL(BG(locale_string))[0] != 'C')) {
key = zend_string_alloc(ZSTR_LEN(regex) + ZSTR_LEN(BG(locale_string)) + 1, 0);
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)
}
/* }}} */
+/* {{{ pcre_get_compiled_regex_cache
+ */
+PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
+{
+ return pcre_get_compiled_regex_cache_ex(regex, 1);
+}
+/* }}} */
+
/* {{{ pcre_get_compiled_regex
*/
PHPAPI pcre2_code *pcre_get_compiled_regex(zend_string *regex, uint32_t *capture_count, uint32_t *preg_options)
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 4c240cbaf9..9fd8259b40 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -44,6 +44,7 @@ extern zend_module_entry pcre_module_entry;
typedef struct _pcre_cache_entry pcre_cache_entry;
PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex);
+PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, int locale_aware);
PHPAPI void php_pcre_match_impl( pcre_cache_entry *pce, char *subject, size_t subject_len, zval *return_value,
zval *subpats, int global, int use_flags, zend_long flags, zend_off_t start_offset);