@@ -715,6 +715,18 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
715
715
}
716
716
}
717
717
718
+ if (poptions & PREG_REPLACE_EVAL ) {
719
+ php_error_docref (NULL , E_WARNING , "The /e modifier is no longer supported, use preg_replace_callback instead" );
720
+ pcre_handle_exec_error (PCRE2_ERROR_INTERNAL );
721
+ efree (pattern );
722
+ #if HAVE_SETLOCALE
723
+ if (key != regex ) {
724
+ zend_string_release_ex (key , 0 );
725
+ }
726
+ #endif
727
+ return NULL ;
728
+ }
729
+
718
730
#if HAVE_SETLOCALE
719
731
if (key != regex ) {
720
732
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
1517
1529
zend_string * result ; /* Result of replacement */
1518
1530
pcre2_match_data * match_data ;
1519
1531
1520
- if (UNEXPECTED (pce -> preg_options & PREG_REPLACE_EVAL )) {
1521
- php_error_docref (NULL , E_WARNING , "The /e modifier is no longer supported, use preg_replace_callback instead" );
1522
- return NULL ;
1523
- }
1524
-
1525
1532
/* Calculate the size of the offsets array, and allocate memory for it. */
1526
1533
num_subpats = pce -> capture_count + 1 ;
1527
1534
@@ -1760,11 +1767,6 @@ static zend_string *php_pcre_replace_func_impl(pcre_cache_entry *pce, zend_strin
1760
1767
pcre2_match_data * match_data ;
1761
1768
zend_bool old_mdata_used ;
1762
1769
1763
- if (UNEXPECTED (pce -> preg_options & PREG_REPLACE_EVAL )) {
1764
- php_error_docref (NULL , E_WARNING , "The /e modifier is no longer supported, use preg_replace_callback instead" );
1765
- return NULL ;
1766
- }
1767
-
1768
1770
/* Calculate the size of the offsets array, and allocate memory for it. */
1769
1771
num_subpats = pce -> capture_count + 1 ;
1770
1772
0 commit comments