summaryrefslogtreecommitdiff
path: root/Zend/tests/array_unpack/string_keys.phpt
blob: 6032d7cc3f23d8d0f35cfcb4bd1f43595f1eabe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
array unpacking with string keys (not supported)
--FILE--
<?php

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

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