1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/gh20628_005.phpt
Ilija Tovilo a01a8e72ac Fix failed assertion for assignment in expression context
This code path is reachable for all assignments expressions, not just true
variable expressions.

Really surprising we have no tests that caught this.
2026-02-01 14:14:08 +01:00

21 lines
275 B
PHP

--TEST--
Failed assertion for assignment in expression context
--CREDITS--
Matteo Beccati (mbeccati)
--FILE--
<?php
function foo() {
return ['bar' => 'baz'];
}
var_dump(($v = foo())['bar'], $v);
?>
--EXPECT--
string(3) "baz"
array(1) {
["bar"]=>
string(3) "baz"
}