Skip to content

Commit e0f8d1d

Browse files
Adding closing tag to test and removing unreacheable statement
1 parent e983de1 commit e0f8d1d

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

ext/standard/string.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,19 +1042,14 @@ PHP_FUNCTION(implode)
10421042
RETURN_THROWS();
10431043
}
10441044

1045-
if (pieces == NULL) {
1046-
if (arg1_array == NULL) {
1047-
zend_type_error("%s(): Argument #1 ($array) must be of type array, string given", get_active_function_name());
1048-
RETURN_THROWS();
1049-
}
1045+
if (pieces != NULL && arg1_str == NULL) {
1046+
zend_argument_type_error(1, "must be of type string, array given");
1047+
RETURN_THROWS();
1048+
}
10501049

1050+
if (pieces == NULL) {
10511051
arg1_str = ZSTR_EMPTY_ALLOC();
10521052
pieces = arg1_array;
1053-
} else {
1054-
if (arg1_str == NULL) {
1055-
zend_argument_type_error(1, "must be of type string, array given");
1056-
RETURN_THROWS();
1057-
}
10581053
}
10591054

10601055
php_implode(arg1_str, pieces, return_value);

ext/standard/tests/strings/implode_error.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ try {
2222
} catch (TypeError $e) {
2323
echo $e->getMessage(), "\n";
2424
}
25+
?>
2526
--EXPECTF--
2627
implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given
2728
implode(): If argument #1 ($separator) is of type string, argument #2 ($array) must be of type array, null given

0 commit comments

Comments
 (0)