summaryrefslogtreecommitdiff
path: root/Zend/tests/arg_unpack/string_keys.phpt
blob: c2913db5b401e99c39cc5dac8926be08a9d1ad44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
Argument unpacking does not work with string keys (forward compatibility for named args)
--FILE--
<?php

set_error_handler(function($errno, $errstr) {
    var_dump($errstr);
});

try {
	var_dump(...[1, 2, "foo" => 3, 4]);
} catch (Error $ex) {
	var_dump($ex->getMessage());
}
try {
	var_dump(...new ArrayIterator([1, 2, "foo" => 3, 4]));
} catch (Error $ex) {
	var_dump($ex->getMessage());
}

?>
--EXPECT--
string(36) "Cannot unpack array with string keys"
string(42) "Cannot unpack Traversable with string keys"