1--TEST--
2SPL: Test ArrayObject::ksort() function : basic functionality with array based store
3--FILE--
4<?php
5/* Sort the entries by key.
6 * Source code: ext/spl/spl_array.c
7 * Alias to functions:
8 */
9
10echo "*** Testing ArrayObject::ksort() : basic functionality ***\n";
11$ao1 = new ArrayObject(array(4,2,3));
12$ao2 = new ArrayObject(array('b'=>4,'a'=>2,'q'=>3, 99=>'x'));
13var_dump($ao1->ksort());
14var_dump($ao1);
15try {
16    var_dump($ao2->ksort('blah'));
17} catch (TypeError $e) {
18    echo $e->getMessage(), "\n";
19}
20var_dump($ao2);
21var_dump($ao2->ksort(SORT_STRING));
22var_dump($ao2);
23?>
24--EXPECTF--
25*** Testing ArrayObject::ksort() : basic functionality ***
26bool(true)
27object(ArrayObject)#%d (1) {
28  ["storage":"ArrayObject":private]=>
29  array(3) {
30    [0]=>
31    int(4)
32    [1]=>
33    int(2)
34    [2]=>
35    int(3)
36  }
37}
38ArrayObject::ksort(): Argument #1 ($flags) must be of type int, string given
39object(ArrayObject)#2 (1) {
40  ["storage":"ArrayObject":private]=>
41  array(4) {
42    ["b"]=>
43    int(4)
44    ["a"]=>
45    int(2)
46    ["q"]=>
47    int(3)
48    [99]=>
49    string(1) "x"
50  }
51}
52bool(true)
53object(ArrayObject)#%d (1) {
54  ["storage":"ArrayObject":private]=>
55  array(4) {
56    [99]=>
57    string(1) "x"
58    ["a"]=>
59    int(2)
60    ["b"]=>
61    int(4)
62    ["q"]=>
63    int(3)
64  }
65}
66