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        try {
11            $ao->exchangeArray([4, 5, 6]);
12        } catch (Error $e) {
13            echo $e->getMessage(), "\n";
14        }
15        var_dump($ao);
16    }
17    return $a <=> $b;
18});
19
20?>
21--EXPECT--
22Modification of ArrayObject during sorting is prohibited
23object(ArrayObject)#1 (1) {
24  ["storage":"ArrayObject":private]=>
25  array(3) {
26    [0]=>
27    int(1)
28    [1]=>
29    int(2)
30    [2]=>
31    int(3)
32  }
33}
34