xref: /PHP-8.0/ext/spl/tests/bug67539.phpt (revision f965e200)
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    try {
10        $GLOBALS['it']->unserialize($GLOBALS['it']->serialize());
11    } catch (Error $e) {
12        echo $e->getMessage(), "\n";
13    }
14    return 0;
15}
16
17$it->uksort('badsort');
18?>
19--EXPECT--
20Modification of ArrayObject during sorting is prohibited
21