php-src/Zend/tests/assign_dim_op_same_var.phpt
Nikita Popov 55aadc647b Fix self-assign evaluation order for ASSIGN_DIM_OP
For $ary[idx] op= $ary we should evaluate the RHS operand first,
otherwise we may create a reference-free recursive array. Use the
same handling we do for the normal $ary[idx] = $ary case.

Fixes oss-fuzz #40287.
2021-11-01 09:50:22 +01:00

19 lines
242 B
PHP

--TEST--
Compound array assignment with same variable
--FILE--
<?php
function test() {
$ary = [[]];
$ary[0] += $ary;
foreach ($ary as $v) {
var_dump($v);
}
}
test();
?>
--EXPECT--
array(1) {
[0]=>
array(0) {
}
}