xref: /PHP-8.3/ext/spl/tests/bug79151.phpt (revision db9776c5)
1--TEST--
2Bug #79151: heap use after free caused by spl_dllist_it_helper_move_forward
3--FILE--
4<?php
5
6$a = new SplDoublyLinkedList();
7$a->setIteratorMode(SplDoublyLinkedList::IT_MODE_LIFO | SplDoublyLinkedList::IT_MODE_DELETE);
8$a->push(1);
9$a->rewind();
10$a->unshift(2);
11var_dump($a->pop());
12var_dump($a->next());
13
14$a = new SplDoublyLinkedList();
15$a->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE);
16$a->unshift(1);
17$a->rewind();
18$a->push(2);
19var_dump($a->shift());
20var_dump($a->next());
21
22?>
23--EXPECT--
24int(1)
25NULL
26int(1)
27NULL
28