xref: /PHP-7.4/ext/spl/tests/bug67539.phpt (revision 51c38a09)
1--TEST--
2Bug #67539 (ArrayIterator use-after-free due to object change during sorting)
3--FILE--
4<?php
5
6$it = new ArrayIterator(array_fill(0,2,'X'), 1 );
7
8function badsort($a, $b) {
9        $GLOBALS['it']->unserialize($GLOBALS['it']->serialize());
10        return TRUE;
11}
12
13$it->uksort('badsort');
14--EXPECTF--
15Warning: Modification of ArrayObject during sorting is prohibited in %sbug67539.php on line %d
16