File tree 1 file changed +16
-13
lines changed
1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -1236,19 +1236,22 @@ PHP_FUNCTION(implode)
1236
1236
Z_PARAM_ARRAY_HT (pieces )
1237
1237
ZEND_PARSE_PARAMETERS_END ();
1238
1238
1239
- if (pieces == NULL ) {
1240
- if (arg1_array == NULL ) {
1241
- zend_type_error ("%s(): Argument #1 ($array) must be of type array, string given" , get_active_function_name ());
1242
- RETURN_THROWS ();
1243
- }
1244
-
1245
- arg1_str = ZSTR_EMPTY_ALLOC ();
1246
- pieces = arg1_array ;
1247
- } else {
1248
- if (arg1_str == NULL ) {
1249
- zend_argument_type_error (1 , "must be of type string, array given" );
1250
- RETURN_THROWS ();
1251
- }
1239
+ switch (ZEND_NUM_ARGS ()) {
1240
+ case 1 :
1241
+ if (arg1_array == NULL ) {
1242
+ zend_type_error ("%s(): Argument #1 ($array) must be of type array, string given" , get_active_function_name ());
1243
+ RETURN_THROWS ();
1244
+ }
1245
+ break ;
1246
+ case 2 :
1247
+ if (arg1_str == NULL ) {
1248
+ zend_argument_type_error (1 , "must be of type string, array given" );
1249
+ RETURN_THROWS ();
1250
+ }
1251
+ break ;
1252
+ default :
1253
+ // already checked by ZPP
1254
+ ZEND_UNREACHABLE ();
1252
1255
}
1253
1256
1254
1257
php_implode (arg1_str , pieces , return_value );
You can’t perform that action at this time.
0 commit comments