Skip to content

Commit e2810b5

Browse files
committed
Fix implode() function signature
1 parent c1103a9 commit e2810b5

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

ext/standard/basic_functions.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,10 +743,10 @@ function wordwrap(string $string, int $width = 75, string $break = "\n", bool $c
743743
*/
744744
function explode(string $separator, string $string, int $limit = PHP_INT_MAX): array {}
745745

746-
function implode(string|array $separator, ?array $array = null): string {}
746+
function implode(string|array $separator, array $array = []): string {}
747747

748748
/** @alias implode */
749-
function join(string|array $separator, ?array $array = null): string {}
749+
function join(string|array $separator, array $array = []): string {}
750750

751751
/** @refcount 1 */
752752
function strtok(string $string, ?string $token = null): string|false {}

ext/standard/basic_functions_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: eb6a3a2e3cf8f62e768d5d4968606438819e6cf0 */
2+
* Stub hash: 972d8d3f3e938e14d3d599067bffd85d75c2e8b9 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_set_time_limit, 0, 1, _IS_BOOL, 0)
55
ZEND_ARG_TYPE_INFO(0, seconds, IS_LONG, 0)
@@ -857,7 +857,7 @@ ZEND_END_ARG_INFO()
857857

858858
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_implode, 0, 1, IS_STRING, 0)
859859
ZEND_ARG_TYPE_MASK(0, separator, MAY_BE_STRING|MAY_BE_ARRAY, NULL)
860-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, array, IS_ARRAY, 1, "null")
860+
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, array, IS_ARRAY, 0, "[]")
861861
ZEND_END_ARG_INFO()
862862

863863
#define arginfo_join arginfo_implode

ext/standard/string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,12 +1233,12 @@ PHP_FUNCTION(implode)
12331233
ZEND_PARSE_PARAMETERS_START(1, 2)
12341234
Z_PARAM_ARRAY_HT_OR_STR(arg1_array, arg1_str)
12351235
Z_PARAM_OPTIONAL
1236-
Z_PARAM_ARRAY_HT_OR_NULL(pieces)
1236+
Z_PARAM_ARRAY_HT(pieces)
12371237
ZEND_PARSE_PARAMETERS_END();
12381238

12391239
if (pieces == NULL) {
12401240
if (arg1_array == NULL) {
1241-
zend_type_error("%s(): Argument #1 ($pieces) must be of type array, string given", get_active_function_name());
1241+
zend_type_error("%s(): Argument #1 ($array) must be of type array, string given", get_active_function_name());
12421242
RETURN_THROWS();
12431243
}
12441244

ext/standard/tests/strings/implode1.phpt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ string(35) "2000-639010PHP000 0string%0with%0...%0"
236236
string(43) "2\00\0-639\01\0PHP\0\0\0 \0string%0with%0...%0"
237237

238238
*** Testing implode() on empty string ***
239-
implode(): Argument #1 ($pieces) must be of type array, string given
239+
implode(): Argument #1 ($array) must be of type array, string given
240240

241241
*** Testing implode() on sub-arrays ***
242242

@@ -266,12 +266,12 @@ array(2) {
266266
string(%d) "Resource id #%d::Resource id #%d"
267267

268268
*** Testing error conditions ***
269-
implode(): Argument #1 ($pieces) must be of type array, string given
270-
implode(): Argument #2 ($array) must be of type ?array, int given
271-
implode(): Argument #1 ($pieces) must be of type array, string given
269+
implode(): Argument #1 ($array) must be of type array, string given
270+
implode(): Argument #2 ($array) must be of type array, int given
271+
implode(): Argument #2 ($array) must be of type array, null given
272272
string(0) ""
273-
implode(): Argument #2 ($array) must be of type ?array, string given
273+
implode(): Argument #2 ($array) must be of type array, string given
274274

275275
Deprecated: implode(): Passing null to parameter #1 ($separator) of type array|string is deprecated in %s on line %d
276-
implode(): Argument #2 ($array) must be of type ?array, string given
276+
implode(): Argument #2 ($array) must be of type array, string given
277277
Done

ext/standard/tests/strings/join_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ echo "Done\n";
2020
*** Testing join() : error conditions ***
2121

2222
-- Testing join() with less than expected no. of arguments --
23-
join(): Argument #1 ($pieces) must be of type array, string given
23+
join(): Argument #1 ($array) must be of type array, string given
2424
Done

ext/standard/tests/strings/join_variation2.phpt

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,49 +102,49 @@ echo "Done\n";
102102

103103
--- Testing join() by supplying different values for 'pieces' argument ---
104104
-- Iteration 1 --
105-
join(): Argument #2 ($array) must be of type ?array, int given
105+
join(): Argument #2 ($array) must be of type array, int given
106106
-- Iteration 2 --
107-
join(): Argument #2 ($array) must be of type ?array, int given
107+
join(): Argument #2 ($array) must be of type array, int given
108108
-- Iteration 3 --
109-
join(): Argument #2 ($array) must be of type ?array, int given
109+
join(): Argument #2 ($array) must be of type array, int given
110110
-- Iteration 4 --
111-
join(): Argument #2 ($array) must be of type ?array, int given
111+
join(): Argument #2 ($array) must be of type array, int given
112112
-- Iteration 5 --
113-
join(): Argument #2 ($array) must be of type ?array, float given
113+
join(): Argument #2 ($array) must be of type array, float given
114114
-- Iteration 6 --
115-
join(): Argument #2 ($array) must be of type ?array, float given
115+
join(): Argument #2 ($array) must be of type array, float given
116116
-- Iteration 7 --
117-
join(): Argument #2 ($array) must be of type ?array, float given
117+
join(): Argument #2 ($array) must be of type array, float given
118118
-- Iteration 8 --
119-
join(): Argument #2 ($array) must be of type ?array, float given
119+
join(): Argument #2 ($array) must be of type array, float given
120120
-- Iteration 9 --
121-
join(): Argument #2 ($array) must be of type ?array, float given
121+
join(): Argument #2 ($array) must be of type array, float given
122122
-- Iteration 10 --
123-
join(): Argument #2 ($array) must be of type ?array, bool given
123+
join(): Argument #2 ($array) must be of type array, bool given
124124
-- Iteration 11 --
125-
join(): Argument #2 ($array) must be of type ?array, bool given
125+
join(): Argument #2 ($array) must be of type array, bool given
126126
-- Iteration 12 --
127-
join(): Argument #2 ($array) must be of type ?array, bool given
127+
join(): Argument #2 ($array) must be of type array, bool given
128128
-- Iteration 13 --
129-
join(): Argument #2 ($array) must be of type ?array, bool given
129+
join(): Argument #2 ($array) must be of type array, bool given
130130
-- Iteration 14 --
131-
join(): Argument #2 ($array) must be of type ?array, string given
131+
join(): Argument #2 ($array) must be of type array, string given
132132
-- Iteration 15 --
133-
join(): Argument #2 ($array) must be of type ?array, string given
133+
join(): Argument #2 ($array) must be of type array, string given
134134
-- Iteration 16 --
135-
join(): Argument #2 ($array) must be of type ?array, test given
135+
join(): Argument #2 ($array) must be of type array, test given
136136
-- Iteration 17 --
137-
join(): Argument #2 ($array) must be of type ?array, string given
137+
join(): Argument #2 ($array) must be of type array, string given
138138
-- Iteration 18 --
139-
join(): Argument #2 ($array) must be of type ?array, string given
139+
join(): Argument #2 ($array) must be of type array, string given
140140
-- Iteration 19 --
141-
join(): Argument #1 ($pieces) must be of type array, string given
141+
join(): Argument #2 ($array) must be of type array, null given
142142
-- Iteration 20 --
143-
join(): Argument #1 ($pieces) must be of type array, string given
143+
join(): Argument #2 ($array) must be of type array, null given
144144
-- Iteration 21 --
145-
join(): Argument #2 ($array) must be of type ?array, resource given
145+
join(): Argument #2 ($array) must be of type array, resource given
146146
-- Iteration 22 --
147-
join(): Argument #1 ($pieces) must be of type array, string given
147+
join(): Argument #2 ($array) must be of type array, null given
148148
-- Iteration 23 --
149-
join(): Argument #1 ($pieces) must be of type array, string given
149+
join(): Argument #2 ($array) must be of type array, null given
150150
Done

0 commit comments

Comments
 (0)