Skip to content

Commit aa66f46

Browse files
Adding correct check and error message
1 parent 72c6102 commit aa66f46

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/standard/string.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,14 @@ PHP_FUNCTION(implode)
10331033
Z_PARAM_ARRAY_HT_OR_NULL(pieces)
10341034
ZEND_PARSE_PARAMETERS_END();
10351035

1036+
if (arg1_str != NULL && pieces == NULL) {
1037+
zend_type_error("%s(): Argument #2 ($array) must be of type array, null given", get_active_function_name());
1038+
RETURN_THROWS();
1039+
}
1040+
10361041
if (pieces == NULL) {
10371042
if (arg1_array == NULL) {
1038-
zend_type_error("%s(): Argument #1 ($array) must be of type array, null given", get_active_function_name());
1043+
zend_type_error("%s(): Argument #1 ($array) must be of type array, string given", get_active_function_name());
10391044
RETURN_THROWS();
10401045
}
10411046

0 commit comments

Comments
 (0)