php-src/Zend/tests/gh11320_2.phpt
Ilija Tovilo 8ed66b4347 Add tests for list() in assignment in array literals
Array literals will constant evaluate their elements. These can include
assignments, even though these are not valid constant expressions. The lhs of
assignments can be a list() element (or []) which is parsed as an array with a
special flag.
2023-05-26 12:15:01 +02:00

13 lines
251 B
PHP

--TEST--
GH-11320: list() expressions can contain magic constants
--FILE--
<?php
[list(__FILE__ => $foo) = [__FILE__ => 'foo']];
var_dump($foo);
[[__FILE__ => $foo] = [__FILE__ => 'foo']];
var_dump($foo);
?>
--EXPECT--
string(3) "foo"
string(3) "foo"