File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Closure::__invoke() with variadic parameter
3
+ --FILE--
4
+ <?php
5
+
6
+ $ closure = function (&...$ refs ) {};
7
+ $ closure ->__invoke (
8
+ $ v1 , $ v2 , $ v3 , $ v4 ,
9
+ $ v5 , $ v6 , $ v7 , $ v8 ,
10
+ $ v9 , $ v10 , $ v11 , $ v12 ,
11
+ $ v13
12
+ );
13
+
14
+ ?>
15
+ ===DONE===
16
+ --EXPECT--
17
+ ===DONE===
Original file line number Diff line number Diff line change @@ -203,14 +203,17 @@ ZEND_API zend_function *zend_get_closure_invoke_method(zend_object *object) /* {
203
203
{
204
204
zend_closure * closure = (zend_closure * )object ;
205
205
zend_function * invoke = (zend_function * )emalloc (sizeof (zend_function ));
206
+ const uint32_t keep_flags =
207
+ ZEND_ACC_RETURN_REFERENCE | ZEND_ACC_VARIADIC | ZEND_ACC_HAS_RETURN_TYPE ;
206
208
207
209
invoke -> common = closure -> func .common ;
208
210
/* We return ZEND_INTERNAL_FUNCTION, but arg_info representation is the
209
211
* same as for ZEND_USER_FUNCTION (uses zend_string* instead of char*).
210
212
* This is not a problem, because ZEND_ACC_HAS_TYPE_HINTS is never set,
211
213
* and we won't check arguments on internal function */
212
214
invoke -> type = ZEND_INTERNAL_FUNCTION ;
213
- invoke -> internal_function .fn_flags = ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure -> func .common .fn_flags & ZEND_ACC_RETURN_REFERENCE );
215
+ invoke -> internal_function .fn_flags =
216
+ ZEND_ACC_PUBLIC | ZEND_ACC_CALL_VIA_HANDLER | (closure -> func .common .fn_flags & keep_flags );
214
217
invoke -> internal_function .handler = ZEND_MN (Closure___invoke );
215
218
invoke -> internal_function .module = 0 ;
216
219
invoke -> internal_function .scope = zend_ce_closure ;
You can’t perform that action at this time.
0 commit comments