mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

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.
19 lines
242 B
PHP
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) {
|
|
}
|
|
}
|