1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/ext/spl/tests/gh18322.phpt
Niels Dossche 67503870ca Fix GH-18322: SplObjectStorage debug handler mismanages memory
This hack was once necessary before there was a proper get_gc handler,
but now it breaks the engine constraints.

Closes GH-18323.
2025-04-14 14:11:09 +02:00

28 lines
433 B
PHP

--TEST--
GH-18322 (SplObjectStorage debug handler mismanages memory)
--FILE--
<?php
$stor = new SplObjectStorage();
$obj = new stdClass;
$stor[$obj] = 1;
$tmp = $stor->__debugInfo();
$tmp2 = $tmp[array_key_first($tmp)];
unset($tmp); // Drop $tmp2 RC to 1
$tmp2[0]['obj'] = new stdClass;
var_dump($tmp2);
?>
--EXPECT--
array(1) {
[0]=>
array(2) {
["obj"]=>
object(stdClass)#3 (0) {
}
["inf"]=>
int(1)
}
}