php-src/Zend/tests/assign_dim_ref_free.phpt
Nikita Popov 6d5ae6496c Fix ASSIGN_DIM to NEXT with rc=1 reference value
The reference wrapper was destroyed while value still pointed into
it and was later used to assign the ASSIGN_DIM return value. This
could be fixed either by moving the return value assignment earlier,
or by working with the value that has been stored in the array.
I'm going with the latter here, because that matches what the
non-NEXT codepath does via assign_to_variable more closely.

Fixes oss-fuzz #36807.
2021-08-03 10:25:24 +02:00

14 lines
154 B
PHP

--TEST--
Assigning rc=1 reference to next dim
--FILE--
<?php
var_dump($ary[] = [&$x] = $x);
var_dump($x);
?>
--EXPECT--
array(1) {
[0]=>
&NULL
}
NULL