1
0
mirror of https://github.com/php/php-src.git synced 2026-04-11 01:53:36 +02:00
Files
archived-php-src/Zend/tests/bug79793.phpt
Nikita Popov 77acc8a069 Fixed bug #79793
Make sure the string key is not released while throwing the
undefined index warning.
2020-07-07 16:29:48 +02:00

33 lines
465 B
PHP

--TEST--
Bug #79793: Use after free if string used in undefined index warning is changed
--FILE--
<?php
$key = "foo";
$key .= "bar";
set_error_handler(function($_, $m) use (&$key) {
echo "$m\n";
$key .= "baz";
});
$ary = [];
$ary[$key]++;
var_dump($ary);
$ary[$key] += 1;
var_dump($ary);
?>
--EXPECT--
Undefined index: foobar
array(1) {
["foobar"]=>
int(1)
}
Undefined index: foobarbaz
array(2) {
["foobar"]=>
int(1)
["foobarbaz"]=>
int(1)
}