com php-src: Merge branch 'PHP-7.2': ext/pcre/php_pcre.c
| From: | Anatol Belski | Date: | Tue, 14 Nov 2017 12:56:25 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.2': ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100225@lists.php.net to get a copy of this message | ||
Commit: a385993c0cfa84920beac3f23ae2b3a81121841a
Author: Anatol Belski <ab@php.net> Tue, 14 Nov 2017 13:56:25 +0100
Parents: 93334b5fc2871679f3f1f1b8db51f9dc8b3284cf 0d1332391573c1dc8218094c150cd9efcc7f6aff
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a385993c0cfa84920beac3f23ae2b3a81121841a
Log:
Merge branch 'PHP-7.2'
* PHP-7.2:
Fix UTF check in pcre_grep
Changed paths:
MM ext/pcre/php_pcre.c
Diff:
diff --cc ext/pcre/php_pcre.c
index 985d2c5,54fd90f..55f432b
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@@ -2710,35 -2569,27 +2710,35 @@@ PHPAPI void php_pcre_grep_impl(pcre_ca
PCRE_G(error_code) = PHP_PCRE_NO_ERROR;
+ if (!mdata_used && num_subpats <= PHP_PCRE_PREALLOC_MDATA_SIZE) {
+ match_data = mdata;
+ } else {
+ match_data = pcre2_match_data_create_from_pattern(pce->re, gctx);
+ if (!match_data) {
+ PCRE_G(error_code) = PHP_PCRE_INTERNAL_ERROR;
+ return;
+ }
+ }
+
+ #ifdef HAVE_PCRE_JIT_SUPPORT
- no_utf_check = (pce->compile_options & PCRE_UTF8) ? 0 : PCRE_NO_UTF8_CHECK;
++ 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 ((extra->flags & PCRE_EXTRA_EXECUTABLE_JIT)
+ if (PCRE_G(jit) && (pce->preg_options && PREG_JIT)
&& no_utf_check) {
- count = pcre_jit_exec(pce->re, extra, ZSTR_VAL(subject_str),
- (int)ZSTR_LEN(subject_str), 0,
- no_utf_check, offsets, size_offsets, jit_stack);
+ count = pcre2_jit_match(pce->re, ZSTR_VAL(subject_str), ZSTR_LEN(subject_str), 0,
+ PCRE2_NO_UTF_CHECK, match_data, mctx);
} else
#endif
- count = pcre_exec(pce->re, extra, ZSTR_VAL(subject_str),
- (int)ZSTR_LEN(subject_str), 0,
- no_utf_check, offsets, size_offsets);
+ 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");