php-src/Zend/tests/bug70662.phpt
Nikita Popov 220880ad2d Fixed bug #78598
When performing an RW modification of an array offset, the undefined
offset warning may call an error handler / OB callback, which may
destroy the array we're supposed to change. Detect this by temporarily
incrementing the reference count. If we find that the array has been
modified/destroyed in the meantime, we do nothing -- the execution
model here would be that the modification has happened on the destroyed
version of the array.
2020-07-07 12:13:58 +02:00

19 lines
236 B
PHP

--TEST--
Bug #70662: Duplicate array key via undefined index error handler
--FILE--
<?php
$a = [];
set_error_handler(function() use(&$a) {
$a['b'] = 2;
});
$a['b'] += 1;
var_dump($a);
?>
--EXPECT--
array(1) {
["b"]=>
int(2)
}