1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 17:22:15 +01:00
Files
archived-php-src/Zend/tests/array_unpack/string_keys.phpt
2020-02-03 22:52:20 +01:00

22 lines
469 B
PHP

--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"