Skip to content

Commit bc24121

Browse files
Splitting paths as suggested by @iluuu1994
1 parent 196095f commit bc24121

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

ext/standard/string.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,33 +1024,21 @@ PHPAPI void php_implode(const zend_string *glue, HashTable *pieces, zval *return
10241024
PHP_FUNCTION(implode)
10251025
{
10261026
zend_string *arg1_str = NULL;
1027-
HashTable *arg1_array = NULL;
10281027
zend_array *pieces = NULL;
10291028

1030-
ZEND_PARSE_PARAMETERS_START(1, 2)
1031-
Z_PARAM_ARRAY_HT_OR_STR(arg1_array, arg1_str)
1032-
Z_PARAM_OPTIONAL
1033-
Z_PARAM_ARRAY_HT_OR_NULL(pieces)
1034-
ZEND_PARSE_PARAMETERS_END();
1029+
if (ZEND_NUM_ARGS() == 1) {
1030+
ZEND_PARSE_PARAMETERS_START(1, 1)
1031+
Z_PARAM_ARRAY_HT(pieces)
1032+
ZEND_PARSE_PARAMETERS_END();
10351033

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();
1034+
arg1_str = ZSTR_EMPTY_ALLOC();
10391035
}
10401036

1041-
if (pieces == NULL) {
1042-
if (arg1_array == NULL) {
1043-
zend_type_error("%s(): Argument #1 ($array) must be of type array, string given", get_active_function_name());
1044-
RETURN_THROWS();
1045-
}
1046-
1047-
arg1_str = ZSTR_EMPTY_ALLOC();
1048-
pieces = arg1_array;
1049-
} else {
1050-
if (arg1_str == NULL) {
1051-
zend_argument_type_error(1, "must be of type string, array given");
1052-
RETURN_THROWS();
1053-
}
1037+
if (ZEND_NUM_ARGS() == 2) {
1038+
ZEND_PARSE_PARAMETERS_START(1, 2)
1039+
Z_PARAM_STR(arg1_str)
1040+
Z_PARAM_ARRAY_HT(pieces)
1041+
ZEND_PARSE_PARAMETERS_END();
10541042
}
10551043

10561044
php_implode(arg1_str, pieces, return_value);

0 commit comments

Comments
 (0)