1--TEST-- 2Traversables cannot be unpacked into by-reference parameters 3--FILE-- 4<?php 5 6function test($val1, $val2, $val3, &$ref) { 7 $ref = 42; 8} 9 10function gen($array) { 11 foreach ($array as $element) { 12 yield $element; 13 } 14} 15 16test(1, 2, 3, $b, ...gen([4, 5, 6])); 17var_dump($b); 18 19test(...gen([1, 2, 3, 4])); 20test(1, 2, ...gen([3, 4])); 21test(...gen([1, 2]), ...gen([3, 4])); 22 23?> 24--EXPECTF-- 25int(42) 26 27Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d 28 29Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d 30 31Warning: Cannot pass by-reference argument 4 of test() by unpacking a Traversable, passing by-value instead in %s on line %d 32