summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2017-11-14 13:56:25 +0100
committerAnatol Belski <ab@php.net>2017-11-14 13:56:25 +0100
commita385993c0cfa84920beac3f23ae2b3a81121841a (patch)
tree62f79dd5fea9f947186f18888cb844533294fe32
parent93334b5fc2871679f3f1f1b8db51f9dc8b3284cf (diff)
parent0d1332391573c1dc8218094c150cd9efcc7f6aff (diff)
downloadphp-git-a385993c0cfa84920beac3f23ae2b3a81121841a.tar.gz
Merge branch 'PHP-7.2'
* PHP-7.2: Fix UTF check in pcre_grep
-rw-r--r--ext/pcre/php_pcre.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 985d2c5aef..55f432b518 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -2720,13 +2720,16 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
}
}
+#ifdef HAVE_PCRE_JIT_SUPPORT
+ no_utf_check = (pce->compile_options & PCRE2_UTF) ? 0 : PCRE2_NO_UTF_CHECK;
+#endif
+
/* Go through the input array */
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(input), num_key, string_key, entry) {
zend_string *subject_str = zval_get_string(entry);
/* Perform the match */
#ifdef HAVE_PCRE_JIT_SUPPORT
- no_utf_check = (pce->compile_options & PCRE2_UTF) ? 0 : PCRE2_NO_UTF_CHECK;
if (PCRE_G(jit) && (pce->preg_options && PREG_JIT)
&& no_utf_check) {
count = pcre2_jit_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), 0,
@@ -2736,9 +2739,6 @@ PHPAPI void php_pcre_grep_impl(pcre_cache_entry *pce, zval *input, zval *return
count = pcre2_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), 0,
no_utf_check, match_data, mctx);
- /* the string was already proved to be valid UTF-8 */
- no_utf_check = PCRE2_NO_UTF_CHECK;
-
/* Check for too many substrings condition. */
if (count == 0) {
php_error_docref(NULL, E_NOTICE, "Matched, but too many substrings");