mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
25 lines
372 B
PHP
25 lines
372 B
PHP
--TEST--
|
|
GH-18833 (Use after free with weakmaps dependent on destruction order)
|
|
--FILE--
|
|
<?php
|
|
|
|
class a {
|
|
public static WeakMap $map;
|
|
public static Generator $storage;
|
|
}
|
|
|
|
a::$map = new WeakMap;
|
|
|
|
$closure = function () {
|
|
$obj = new a;
|
|
a::$map[$obj] = true;
|
|
yield $obj;
|
|
};
|
|
a::$storage = $closure();
|
|
a::$storage->current();
|
|
|
|
echo "ok\n";
|
|
?>
|
|
--EXPECT--
|
|
ok
|