php-src/Zend/tests/array_unpack/gh9769.phpt
蝦米 93592ea743
Fix GH-9769: Misleading error message for unpacking of objects
Only arrays can be unpacked in constant expressions.

Closes GH-9776.
2022-12-02 13:10:59 +01:00

15 lines
353 B
PHP

--TEST--
Unpacking arrays in constant expression
--FILE--
<?php
const A = [...[1, 2, 3]];
const B = [...['a'=>1, 'b'=>2, 'c'=>3]];
const C = [...new ArrayObject()];
?>
--EXPECTF--
Fatal error: Uncaught Error: Only arrays can be unpacked in constant expression in %sgh9769.php:5
Stack trace:
#0 {main}
thrown in %sgh9769.php on line 5