1--TEST--
2Test sorting of various ArrayObject backing storage
3--FILE--
4<?php
5
6$obj = (object)['a' => 2, 'b' => 1];
7$ao = new ArrayObject($obj);
8$ao->uasort(function($a, $b) { return $a <=> $b; });
9var_dump($ao);
10
11$ao2 = new ArrayObject($ao);
12$ao2->uasort(function($a, $b) { return $b <=> $a; });
13var_dump($ao2);
14
15$ao3 = new ArrayObject();
16$ao3->exchangeArray($ao3);
17$ao3->a = 2;
18$ao3->b = 1;
19$ao3->uasort(function($a, $b) { return $a <=> $b; });
20var_dump($ao3);
21
22$ao4 = new ArrayObject([]);
23$ao4->uasort(function($a, $b) { return $a <=> $b; });
24var_dump($ao4);
25
26$ao5 = new ArrayObject(['a' => 2, 'b' => 1]);
27$ao5->uasort(function($a, $b) { return $a <=> $b; });
28var_dump($ao5);
29
30?>
31--EXPECT--
32object(ArrayObject)#2 (1) {
33  ["storage":"ArrayObject":private]=>
34  object(stdClass)#1 (2) {
35    ["b"]=>
36    int(1)
37    ["a"]=>
38    int(2)
39  }
40}
41object(ArrayObject)#3 (1) {
42  ["storage":"ArrayObject":private]=>
43  object(ArrayObject)#2 (1) {
44    ["storage":"ArrayObject":private]=>
45    object(stdClass)#1 (2) {
46      ["a"]=>
47      int(2)
48      ["b"]=>
49      int(1)
50    }
51  }
52}
53object(ArrayObject)#4 (2) {
54  ["b"]=>
55  int(1)
56  ["a"]=>
57  int(2)
58}
59object(ArrayObject)#5 (1) {
60  ["storage":"ArrayObject":private]=>
61  array(0) {
62  }
63}
64object(ArrayObject)#6 (1) {
65  ["storage":"ArrayObject":private]=>
66  array(2) {
67    ["b"]=>
68    int(1)
69    ["a"]=>
70    int(2)
71  }
72}
73