File tree 1 file changed +18
-13
lines changed
1 file changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -1033,19 +1033,24 @@ PHP_FUNCTION(implode)
1033
1033
Z_PARAM_ARRAY_HT (pieces )
1034
1034
ZEND_PARSE_PARAMETERS_END ();
1035
1035
1036
- if (pieces == NULL ) {
1037
- if (arg1_array == NULL ) {
1038
- zend_type_error ("%s(): Argument #1 ($array) must be of type array, string given" , get_active_function_name ());
1039
- RETURN_THROWS ();
1040
- }
1041
-
1042
- arg1_str = ZSTR_EMPTY_ALLOC ();
1043
- pieces = arg1_array ;
1044
- } else {
1045
- if (arg1_str == NULL ) {
1046
- zend_argument_type_error (1 , "must be of type string, array given" );
1047
- RETURN_THROWS ();
1048
- }
1036
+ switch (ZEND_NUM_ARGS ()) {
1037
+ case 1 :
1038
+ if (arg1_array == NULL ) {
1039
+ zend_type_error ("%s(): Argument #1 ($array) must be of type array, string given" , get_active_function_name ());
1040
+ RETURN_THROWS ();
1041
+ }
1042
+ arg1_str = ZSTR_EMPTY_ALLOC ();
1043
+ pieces = arg1_array ;
1044
+ break ;
1045
+ case 2 :
1046
+ if (arg1_str == NULL ) {
1047
+ zend_argument_type_error (1 , "must be of type string, array given" );
1048
+ RETURN_THROWS ();
1049
+ }
1050
+ break ;
1051
+ default :
1052
+ // already checked by ZPP
1053
+ ZEND_UNREACHABLE ();
1049
1054
}
1050
1055
1051
1056
php_implode (arg1_str , pieces , return_value );
You can’t perform that action at this time.
0 commit comments