@@ -1059,8 +1059,12 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
1059
1059
syntax = MBREX (regex_default_syntax );
1060
1060
}
1061
1061
}
1062
- if (eval && !is_callable ) {
1063
- php_error_docref (NULL , E_WARNING , "The 'e' option is no longer supported, use mb_ereg_replace_callback instead" );
1062
+ if (eval ) {
1063
+ if (is_callable ) {
1064
+ php_error_docref (NULL , E_WARNING , "Option 'e' cannot be used with replacement callback" );
1065
+ } else {
1066
+ php_error_docref (NULL , E_WARNING , "The 'e' option is no longer supported, use mb_ereg_replace_callback instead" );
1067
+ }
1064
1068
RETURN_FALSE ;
1065
1069
}
1066
1070
@@ -1070,21 +1074,14 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
1070
1074
RETURN_FALSE ;
1071
1075
}
1072
1076
1073
- if (eval || is_callable ) {
1077
+ if (is_callable ) {
1074
1078
pbuf = & eval_buf ;
1075
1079
description = zend_make_compiled_string_description ("mbregex replace" );
1076
1080
} else {
1077
1081
pbuf = & out_buf ;
1078
1082
description = NULL ;
1079
1083
}
1080
1084
1081
- if (is_callable ) {
1082
- if (eval ) {
1083
- php_error_docref (NULL , E_WARNING , "Option 'e' cannot be used with replacement callback" );
1084
- RETURN_FALSE ;
1085
- }
1086
- }
1087
-
1088
1085
/* do the actual work */
1089
1086
err = 0 ;
1090
1087
pos = (OnigUChar * )string ;
@@ -1106,35 +1103,7 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
1106
1103
mb_regex_substitute (pbuf , string , string_len , replace , replace_len , re , regs , enc );
1107
1104
}
1108
1105
1109
- if (eval ) {
1110
- zval v ;
1111
- zend_string * eval_str ;
1112
- /* null terminate buffer */
1113
- smart_str_0 (& eval_buf );
1114
-
1115
- if (eval_buf .s ) {
1116
- eval_str = eval_buf .s ;
1117
- } else {
1118
- eval_str = ZSTR_EMPTY_ALLOC ();
1119
- }
1120
-
1121
- /* do eval */
1122
- if (zend_eval_stringl (ZSTR_VAL (eval_str ), ZSTR_LEN (eval_str ), & v , description ) == FAILURE ) {
1123
- efree (description );
1124
- zend_throw_error (NULL , "Failed evaluating code: %s%s" , PHP_EOL , ZSTR_VAL (eval_str ));
1125
- onig_region_free (regs , 1 );
1126
- smart_str_free (& out_buf );
1127
- smart_str_free (& eval_buf );
1128
- RETURN_FALSE ;
1129
- }
1130
-
1131
- /* result of eval */
1132
- convert_to_string (& v );
1133
- smart_str_appendl (& out_buf , Z_STRVAL (v ), Z_STRLEN (v ));
1134
- /* Clean up */
1135
- smart_str_free (& eval_buf );
1136
- zval_ptr_dtor_str (& v );
1137
- } else if (is_callable ) {
1106
+ if (is_callable ) {
1138
1107
zval args [1 ];
1139
1108
zval subpats , retval ;
1140
1109
int i ;
0 commit comments