diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-07-18 16:35:17 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-07-18 16:35:17 +0300 |
commit | 29f942b3d03e9b7ef4cc06e05928012a092ffdb7 (patch) | |
tree | 1714d888e82adbd8d1a7ac1d65d09089cde5589b /ext/pcre/php_pcre.c | |
parent | 5d6065116518c1601a516aca1b02be8c38496dca (diff) | |
download | php-git-29f942b3d03e9b7ef4cc06e05928012a092ffdb7.tar.gz |
Move "/e" modifier check into regex compiler
Diffstat (limited to 'ext/pcre/php_pcre.c')
-rw-r--r-- | ext/pcre/php_pcre.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 22f3d15313..ffa9d79e0a 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; |