xref: /PHP-8.4/ext/spl/tests/gh16588.phpt (revision 144d2ee2)
1--TEST--
2GH-16588 (UAF in Observer->serialize)
3--CREDITS--
4chibinz
5--FILE--
6<?php
7
8class C {
9    function __serialize(): array {
10        global $store;
11        $store->removeAll($store);
12        return [];
13    }
14}
15
16$store = new SplObjectStorage;
17$store[new C] = new stdClass;
18var_dump($store->serialize());
19
20?>
21--EXPECT--
22string(47) "x:i:1;O:1:"C":0:{},O:8:"stdClass":0:{};m:a:0:{}"
23