@@ -90,7 +90,7 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void) /* {{{ */
90
90
const char * space ;
91
91
const char * class_name = get_active_class_name (& space );
92
92
93
- zend_internal_argument_count_error ( ZEND_ARG_USES_STRICT_TYPES (), "Wrong parameter count for %s%s%s()" , class_name , space , get_active_function_name ());
93
+ zend_argument_count_error ( "Wrong parameter count for %s%s%s()" , class_name , space , get_active_function_name ());
94
94
}
95
95
/* }}} */
96
96
@@ -167,34 +167,13 @@ ZEND_API zend_string *zend_zval_get_type(const zval *arg) /* {{{ */
167
167
}
168
168
/* }}} */
169
169
170
- ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_error (void ) /* {{{ */
171
- {
172
- int num_args = ZEND_CALL_NUM_ARGS (EG (current_execute_data ));
173
- zend_function * active_function = EG (current_execute_data )-> func ;
174
- const char * class_name = active_function -> common .scope ? ZSTR_VAL (active_function -> common .scope -> name ) : "" ;
175
-
176
- zend_internal_argument_count_error (
177
- ZEND_ARG_USES_STRICT_TYPES (),
178
- "%s%s%s() expects %s %d parameter%s, %d given" ,
179
- class_name , \
180
- class_name [0 ] ? "::" : "" , \
181
- ZSTR_VAL (active_function -> common .function_name ),
182
- "exactly" ,
183
- 0 ,
184
- "s" ,
185
- num_args );
186
- return FAILURE ;
187
- }
188
- /* }}} */
189
-
190
170
ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception (void ) /* {{{ */
191
171
{
192
172
int num_args = ZEND_CALL_NUM_ARGS (EG (current_execute_data ));
193
173
zend_function * active_function = EG (current_execute_data )-> func ;
194
174
const char * class_name = active_function -> common .scope ? ZSTR_VAL (active_function -> common .scope -> name ) : "" ;
195
175
196
- zend_internal_argument_count_error (
197
- 1 ,
176
+ zend_argument_count_error (
198
177
"%s%s%s() expects %s %d parameter%s, %d given" ,
199
178
class_name , \
200
179
class_name [0 ] ? "::" : "" , \
@@ -207,33 +186,13 @@ ZEND_API ZEND_COLD int ZEND_FASTCALL zend_wrong_parameters_none_exception(void)
207
186
}
208
187
/* }}} */
209
188
210
- ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error (int min_num_args , int max_num_args ) /* {{{ */
211
- {
212
- int num_args = ZEND_CALL_NUM_ARGS (EG (current_execute_data ));
213
- zend_function * active_function = EG (current_execute_data )-> func ;
214
- const char * class_name = active_function -> common .scope ? ZSTR_VAL (active_function -> common .scope -> name ) : "" ;
215
-
216
- zend_internal_argument_count_error (
217
- ZEND_ARG_USES_STRICT_TYPES (),
218
- "%s%s%s() expects %s %d parameter%s, %d given" ,
219
- class_name , \
220
- class_name [0 ] ? "::" : "" , \
221
- ZSTR_VAL (active_function -> common .function_name ),
222
- min_num_args == max_num_args ? "exactly" : num_args < min_num_args ? "at least" : "at most" ,
223
- num_args < min_num_args ? min_num_args : max_num_args ,
224
- (num_args < min_num_args ? min_num_args : max_num_args ) == 1 ? "" : "s" ,
225
- num_args );
226
- }
227
- /* }}} */
228
-
229
189
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_exception (int min_num_args , int max_num_args ) /* {{{ */
230
190
{
231
191
int num_args = ZEND_CALL_NUM_ARGS (EG (current_execute_data ));
232
192
zend_function * active_function = EG (current_execute_data )-> func ;
233
193
const char * class_name = active_function -> common .scope ? ZSTR_VAL (active_function -> common .scope -> name ) : "" ;
234
194
235
- zend_internal_argument_count_error (
236
- 1 ,
195
+ zend_argument_count_error (
237
196
"%s%s%s() expects %s %d parameter%s, %d given" ,
238
197
class_name , \
239
198
class_name [0 ] ? "::" : "" , \
@@ -245,20 +204,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_exception(int
245
204
}
246
205
/* }}} */
247
206
248
- ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error (int num , zend_expected_type expected_type , zval * arg ) /* {{{ */
249
- {
250
- const char * space ;
251
- const char * class_name = get_active_class_name (& space );
252
- static const char * const expected_error [] = {
253
- Z_EXPECTED_TYPES (Z_EXPECTED_TYPE_STR )
254
- NULL
255
- };
256
-
257
- zend_internal_type_error (ZEND_ARG_USES_STRICT_TYPES (), "%s%s%s() expects parameter %d to be %s, %s given" ,
258
- class_name , space , get_active_function_name (), num , expected_error [expected_type ], zend_zval_type_name (arg ));
259
- }
260
- /* }}} */
261
-
262
207
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception (int num , zend_expected_type expected_type , zval * arg ) /* {{{ */
263
208
{
264
209
const char * space ;
@@ -268,48 +213,27 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_exception(int nu
268
213
NULL
269
214
};
270
215
271
- zend_internal_type_error ( 1 , "%s%s%s() expects parameter %d to be %s, %s given" ,
216
+ zend_type_error ( "%s%s%s() expects parameter %d to be %s, %s given" ,
272
217
class_name , space , get_active_function_name (), num , expected_error [expected_type ], zend_zval_type_name (arg ));
273
218
}
274
219
/* }}} */
275
220
276
- ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_error (int num , char * name , zval * arg ) /* {{{ */
277
- {
278
- const char * space ;
279
- const char * class_name = get_active_class_name (& space );
280
-
281
- zend_internal_type_error (ZEND_ARG_USES_STRICT_TYPES (), "%s%s%s() expects parameter %d to be %s, %s given" ,
282
- class_name , space , get_active_function_name (), num , name , zend_zval_type_name (arg ));
283
- }
284
- /* }}} */
285
-
286
221
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_exception (int num , char * name , zval * arg ) /* {{{ */
287
222
{
288
223
const char * space ;
289
224
const char * class_name = get_active_class_name (& space );
290
225
291
- zend_internal_type_error ( 1 , "%s%s%s() expects parameter %d to be %s, %s given" ,
226
+ zend_type_error ( "%s%s%s() expects parameter %d to be %s, %s given" ,
292
227
class_name , space , get_active_function_name (), num , name , zend_zval_type_name (arg ));
293
228
}
294
229
/* }}} */
295
230
296
- ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error (int num , char * error ) /* {{{ */
297
- {
298
- const char * space ;
299
- const char * class_name = get_active_class_name (& space );
300
-
301
- zend_internal_type_error (ZEND_ARG_USES_STRICT_TYPES (), "%s%s%s() expects parameter %d to be a valid callback, %s" ,
302
- class_name , space , get_active_function_name (), num , error );
303
- efree (error );
304
- }
305
- /* }}} */
306
-
307
231
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_exception (int num , char * error ) /* {{{ */
308
232
{
309
233
const char * space ;
310
234
const char * class_name = get_active_class_name (& space );
311
235
312
- zend_internal_type_error ( 1 , "%s%s%s() expects parameter %d to be a valid callback, %s" ,
236
+ zend_type_error ( "%s%s%s() expects parameter %d to be a valid callback, %s" ,
313
237
class_name , space , get_active_function_name (), num , error );
314
238
efree (error );
315
239
}
@@ -330,7 +254,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc
330
254
const char * space ;
331
255
const char * class_name = get_active_class_name (& space );
332
256
333
- zend_internal_type_error ( ZEND_ARG_USES_STRICT_TYPES (), "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given" ,
257
+ zend_type_error ( "%s%s%s() expects parameter %d to be a class name derived from %s, '%s' given" ,
334
258
class_name , space , get_active_function_name (), num ,
335
259
ZSTR_VAL (ce_base -> name ), Z_STRVAL_P (arg ));
336
260
* pce = NULL ;
@@ -341,7 +265,7 @@ ZEND_API int ZEND_FASTCALL zend_parse_arg_class(zval *arg, zend_class_entry **pc
341
265
const char * space ;
342
266
const char * class_name = get_active_class_name (& space );
343
267
344
- zend_internal_type_error ( ZEND_ARG_USES_STRICT_TYPES (), "%s%s%s() expects parameter %d to be a valid class name, '%s' given" ,
268
+ zend_type_error ( "%s%s%s() expects parameter %d to be a valid class name, '%s' given" ,
345
269
class_name , space , get_active_function_name (), num ,
346
270
Z_STRVAL_P (arg ));
347
271
return 0 ;
@@ -803,16 +727,13 @@ static int zend_parse_arg(int arg_num, zval *arg, va_list *va, const char **spec
803
727
if (!(flags & ZEND_PARSE_PARAMS_QUIET ) && (* expected_type || error )) {
804
728
const char * space ;
805
729
const char * class_name = get_active_class_name (& space );
806
- zend_bool throw_exception =
807
- ZEND_ARG_USES_STRICT_TYPES () || (flags & ZEND_PARSE_PARAMS_THROW );
808
730
809
731
if (error ) {
810
- zend_internal_type_error ( throw_exception , "%s%s%s() expects parameter %d %s" ,
732
+ zend_type_error ( "%s%s%s() expects parameter %d %s" ,
811
733
class_name , space , get_active_function_name (), arg_num , error );
812
734
efree (error );
813
735
} else {
814
- zend_internal_type_error (throw_exception ,
815
- "%s%s%s() expects parameter %d to be %s, %s given" ,
736
+ zend_type_error ("%s%s%s() expects parameter %d to be %s, %s given" ,
816
737
class_name , space , get_active_function_name (), arg_num , expected_type ,
817
738
zend_zval_type_name (arg ));
818
739
}
@@ -919,8 +840,7 @@ static int zend_parse_va_args(int num_args, const char *type_spec, va_list *va,
919
840
if (!(flags & ZEND_PARSE_PARAMS_QUIET )) {
920
841
zend_function * active_function = EG (current_execute_data )-> func ;
921
842
const char * class_name = active_function -> common .scope ? ZSTR_VAL (active_function -> common .scope -> name ) : "" ;
922
- zend_bool throw_exception = ZEND_ARG_USES_STRICT_TYPES () || (flags & ZEND_PARSE_PARAMS_THROW );
923
- zend_internal_argument_count_error (throw_exception , "%s%s%s() expects %s %d parameter%s, %d given" ,
843
+ zend_argument_count_error ("%s%s%s() expects %s %d parameter%s, %d given" ,
924
844
class_name ,
925
845
class_name [0 ] ? "::" : "" ,
926
846
ZSTR_VAL (active_function -> common .function_name ),
0 commit comments