mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
cc3c425af8
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.
19 lines
236 B
PHP
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)
|
|
}
|