better way to access json globals on PHP 5
[m6w6/ext-json_post] / tests / 001.phpt
1 --TEST--
2 json_post with most common types, as array
3 --SKIPIF--
4 <?php
5 extension_loaded("json_post") or die("skip need json_post support\n");
6 ?>
7 --POST_RAW--
8 Content-type: text/json
9
10 {
11 "null": null,
12 "bool": true,
13 "int": 123,
14 "float": 123.123,
15 "string": "Hello World",
16 "array": [1,2,3],
17 "object": {
18 "array": [1,2,3],
19 "unicode": "\u00D6sterreich"
20 }
21 }
22 --FILE--
23 <?php
24 var_dump($_POST, json_last_error());
25 ?>
26 Done
27 --EXPECTF--
28 array(7) {
29 ["null"]=>
30 NULL
31 ["bool"]=>
32 bool(true)
33 ["int"]=>
34 int(123)
35 ["float"]=>
36 float(123.123)
37 ["string"]=>
38 string(11) "Hello World"
39 ["array"]=>
40 array(3) {
41 [0]=>
42 int(1)
43 [1]=>
44 int(2)
45 [2]=>
46 int(3)
47 }
48 ["object"]=>
49 array(2) {
50 ["array"]=>
51 array(3) {
52 [0]=>
53 int(1)
54 [1]=>
55 int(2)
56 [2]=>
57 int(3)
58 }
59 ["unicode"]=>
60 string(11) "Österreich"
61 }
62 }
63 int(0)
64 Done