php-src/Zend/tests/bug70662.phpt
Nikita Popov cc3c425af8 Fix bug #70662
This replaces add_new with update for the RW case. This should not
be problematic for performance, as this branch throws a notice.

Alternatively add_new could also be replaced with add. I went with
update, because it makes $a[0] += 1 behavior the same as
$a[0] = $a[0] + 1.
2015-10-08 11:03:39 +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(1)
}