mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
pcre: Stop special-casing /e (#12355)
Support for /e was removed in PHP 7.0, remove the custom error message and stop special casing it to simplify the logic.
This commit is contained in:
parent
5cc6979210
commit
72cac39698
3 changed files with 2 additions and 20 deletions
|
@ -34,8 +34,6 @@
|
|||
#define PREG_SPLIT_DELIM_CAPTURE (1<<1)
|
||||
#define PREG_SPLIT_OFFSET_CAPTURE (1<<2)
|
||||
|
||||
#define PREG_REPLACE_EVAL (1<<0)
|
||||
|
||||
#define PREG_GREP_INVERT (1<<0)
|
||||
|
||||
#define PREG_JIT (1<<3)
|
||||
|
@ -737,14 +735,12 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
|
|||
break;
|
||||
case 'J': coptions |= PCRE2_DUPNAMES; break;
|
||||
|
||||
/* Custom preg options */
|
||||
case 'e': poptions |= PREG_REPLACE_EVAL; break;
|
||||
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\r':
|
||||
break;
|
||||
|
||||
case 'e': /* legacy eval */
|
||||
default:
|
||||
if (pp[-1]) {
|
||||
php_error_docref(NULL, E_WARNING, "Unknown modifier '%c'", pp[-1]);
|
||||
|
@ -760,16 +756,6 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache_ex(zend_string *regex, in
|
|||
}
|
||||
}
|
||||
|
||||
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 (key != regex) {
|
||||
zend_string_release_ex(key, 0);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (key != regex) {
|
||||
tables = (uint8_t *)zend_hash_find_ptr(&char_tables, BG(ctype_string));
|
||||
if (!tables) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue