Skip to content

Commit e86f567

Browse files
Reverting checks to original structure, changing only the error messages
1 parent 2193972 commit e86f567

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

ext/standard/string.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,23 +1033,23 @@ 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(
1038-
"%s(): If argument #1 ($separator) is of type string, "
1039-
"argument #2 ($array) must be of type array, null given",
1040-
get_active_function_name()
1041-
);
1042-
RETURN_THROWS();
1043-
}
1044-
1045-
if (pieces != NULL && arg1_str == NULL) {
1046-
zend_argument_type_error(1, "must be of type string, array given");
1047-
RETURN_THROWS();
1048-
}
1049-
10501036
if (pieces == NULL) {
1037+
if (arg1_array == NULL) {
1038+
zend_type_error(
1039+
"%s(): If argument #1 ($separator) is of type string, "
1040+
"argument #2 ($array) must be of type array, null given",
1041+
get_active_function_name()
1042+
);
1043+
RETURN_THROWS();
1044+
}
1045+
10511046
arg1_str = ZSTR_EMPTY_ALLOC();
10521047
pieces = arg1_array;
1048+
} else {
1049+
if (arg1_str == NULL) {
1050+
zend_argument_type_error(1, "must be of type string, array given");
1051+
RETURN_THROWS();
1052+
}
10531053
}
10541054

10551055
php_implode(arg1_str, pieces, return_value);

0 commit comments

Comments
 (0)