xref: /php-src/ext/spl/tests/gh16589.phpt (revision 8f60309a)
1--TEST--
2GH-16589 (UAF in SplDoublyLinked->serialize())
3--CREDITS--
4chibinz
5--FILE--
6<?php
7
8class C {
9    function __serialize(): array {
10        global $list;
11        $list->pop();
12        return [];
13    }
14}
15
16$list = new SplDoublyLinkedList;
17$list->add(0, new C);
18$list->add(1, 1);
19var_dump($list->serialize());
20
21?>
22--EXPECT--
23string(17) "i:0;:O:1:"C":0:{}"
24