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--EXPECTF--
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}
53
54Deprecated: Creation of dynamic property ArrayObject::$a is deprecated in %s on line %d
55
56Deprecated: Creation of dynamic property ArrayObject::$b is deprecated in %s on line %d
57object(ArrayObject)#4 (2) {
58  ["b"]=>
59  int(1)
60  ["a"]=>
61  int(2)
62}
63object(ArrayObject)#5 (1) {
64  ["storage":"ArrayObject":private]=>
65  array(0) {
66  }
67}
68object(ArrayObject)#6 (1) {
69  ["storage":"ArrayObject":private]=>
70  array(2) {
71    ["b"]=>
72    int(1)
73    ["a"]=>
74    int(2)
75  }
76}
77