1--TEST--
2Can't use exchangeArray() while ArrayObject is being sorted
3--FILE--
4<?php
5
6$ao = new ArrayObject([1, 2, 3]);
7$i = 0;
8$ao->uasort(function($a, $b) use ($ao, &$i) {
9    if ($i++ == 0) {
10        $ao->exchangeArray([4, 5, 6]);
11        var_dump($ao);
12    }
13    return $a <=> $b;
14});
15
16?>
17--EXPECTF--
18Warning: Modification of ArrayObject during sorting is prohibited in %s on line %d
19object(ArrayObject)#1 (1) {
20  ["storage":"ArrayObject":private]=>
21  array(3) {
22    [0]=>
23    int(1)
24    [1]=>
25    int(2)
26    [2]=>
27    int(3)
28  }
29}
30