com php-src: Move "/e" modifier check into regex compiler: ext/pcre/php_pcre.c

From: Date: Wed, 18 Jul 2018 13:35:17 +0000
Subject: com php-src: Move "/e" modifier check into regex compiler: ext/pcre/php_pcre.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102601@lists.php.net to get a copy of this message
Commit: 29f942b3d03e9b7ef4cc06e05928012a092ffdb7 Author: Dmitry Stogov <dmitry@zend.com> Wed, 18 Jul 2018 16:35:17 +0300 Parents: 5d6065116518c1601a516aca1b02be8c38496dca Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=29f942b3d03e9b7ef4cc06e05928012a092ffdb7 Log: Move "/e" modifier check into regex compiler Changed paths: M ext/pcre/php_pcre.c Diff: diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 22f3d15..ffa9d79 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -715,6 +715,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex) } } + if (poptions & PREG_REPLACE_EVAL) { + php_error_docref(NULL, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead"); + pcre_handle_exec_error(PCRE2_ERROR_INTERNAL); + efree(pattern); +#if HAVE_SETLOCALE + if (key != regex) { + zend_string_release_ex(key, 0); + } +#endif + return NULL; + } + #if HAVE_SETLOCALE if (key != regex) { tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(locale_string)); @@ -1517,11 +1529,6 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su zend_string *result; /* Result of replacement */ pcre2_match_data *match_data; - if (UNEXPECTED(pce->preg_options & PREG_REPLACE_EVAL)) { - php_error_docref(NULL, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead"); - return NULL; - } - /* Calculate the size of the offsets array, and allocate memory for it. */ num_subpats = pce->capture_count + 1; @@ -1760,11 +1767,6 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin pcre2_match_data *match_data; zend_bool old_mdata_used; - if (UNEXPECTED(pce->preg_options & PREG_REPLACE_EVAL)) { - php_error_docref(NULL, E_WARNING, "The /e modifier is no longer supported, use preg_replace_callback instead"); - return NULL; - } - /* Calculate the size of the offsets array, and allocate memory for it. */ num_subpats = pce->capture_count + 1;

« previous php.cvs (#102601) next »