NULL
NULL
NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-object(stdClass)#1 (1) {
+string(1) "."
+string(1) "."
+string(3) "<?>"
+string(1) ";"
+string(12) "руссиш"
+string(4) "blah"
+NULL
+object(stdClass)#%d (1) {
["test"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
["foo"]=>
string(3) "bar"
}
}
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
["test"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
["foo"]=>
string(0) ""
}
}
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
["_empty_"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
["foo"]=>
string(0) ""
}
}
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
["_empty_"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
["_empty_"]=>
string(0) ""
}
}
-NULL
-NULL
+string(16) "{ "": { "": "" }"
+string(16) "{ "": "": "" } }"
Done
--UEXPECTF--
Warning: json_decode() expects at least 1 parameter, 0 given in %s on line %d
NULL
NULL
NULL
+unicode(1) "."
+unicode(1) "."
+unicode(3) "<?>"
+unicode(1) ";"
+unicode(6) "руссиш"
+unicode(4) "blah"
NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
[u"test"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
[u"foo"]=>
- string(3) "bar"
+ unicode(3) "bar"
}
}
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
[u"test"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
[u"foo"]=>
- string(0) ""
+ unicode(0) ""
}
}
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
[u"_empty_"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
[u"foo"]=>
- string(0) ""
+ unicode(0) ""
}
}
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
[u"_empty_"]=>
- object(stdClass)#2 (1) {
+ object(stdClass)#%d (1) {
[u"_empty_"]=>
- string(0) ""
+ unicode(0) ""
}
}
-NULL
-NULL
+unicode(16) "{ "": { "": "" }"
+unicode(16) "{ "": "": "" } }"
Done
Warning: json_encode(): recursion detected in %s on line %d
string(22) "{"prop":{"prop":null}}"
Done
+--UEXPECTF--
+object(stdClass)#%d (1) {
+ [u"prop"]=>
+ object(stdClass)#%d (1) {
+ [u"prop"]=>
+ *RECURSION*
+ }
+}
+
+Warning: json_encode(): recursion detected in %s on line %d
+string(22) "{"prop":{"prop":null}}"
+Done
Warning: json_encode(): recursion detected in %s on line %d
string(8) "[[null]]"
Done
+--UEXPECTF--
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ *RECURSION*
+ }
+}
+
+Warning: json_encode(): recursion detected in %s on line %d
+unicode(8) "[[null]]"
+Done
--EXPECT--
Testing: "A JSON payload should be an object or array, not a string."
AS OBJECT
-NULL
+string(58) "A JSON payload should be an object or array, not a string."
AS ARRAY
-NULL
+string(58) "A JSON payload should be an object or array, not a string."
Testing: ["Unclosed array"
AS OBJECT
-NULL
+string(17) "["Unclosed array""
AS ARRAY
-NULL
+string(17) "["Unclosed array""
Testing: {unquoted_key: "keys must be quoted}
AS OBJECT
-NULL
+string(36) "{unquoted_key: "keys must be quoted}"
AS ARRAY
-NULL
+string(36) "{unquoted_key: "keys must be quoted}"
Testing: ["extra comma",]
AS OBJECT
-NULL
+string(16) "["extra comma",]"
AS ARRAY
-NULL
+string(16) "["extra comma",]"
Testing: ["double extra comma",,]
AS OBJECT
-NULL
+string(24) "["double extra comma",,]"
AS ARRAY
-NULL
+string(24) "["double extra comma",,]"
Testing: [ , "<-- missing value"]
AS OBJECT
-NULL
+string(26) "[ , "<-- missing value"]"
AS ARRAY
-NULL
+string(26) "[ , "<-- missing value"]"
Testing: ["Comma after the close"],
AS OBJECT
-NULL
+string(26) "["Comma after the close"],"
AS ARRAY
-NULL
+string(26) "["Comma after the close"],"
Testing: ["Extra close"]]
AS OBJECT
-NULL
+string(16) "["Extra close"]]"
AS ARRAY
-NULL
+string(16) "["Extra close"]]"
Testing: {"Extra comma": true,}
AS OBJECT
-NULL
+string(22) "{"Extra comma": true,}"
AS ARRAY
-NULL
+string(22) "{"Extra comma": true,}"
Testing: {"Extra value after close": true} "misplaced quoted value"
AS OBJECT
-NULL
+string(58) "{"Extra value after close": true} "misplaced quoted value""
AS ARRAY
-NULL
+string(58) "{"Extra value after close": true} "misplaced quoted value""
Testing: {"Illegal expression": 1 + 2}
AS OBJECT
-NULL
+string(29) "{"Illegal expression": 1 + 2}"
AS ARRAY
-NULL
+string(29) "{"Illegal expression": 1 + 2}"
Testing: {"Illegal invocation": alert()}
AS OBJECT
-NULL
+string(31) "{"Illegal invocation": alert()}"
AS ARRAY
-NULL
+string(31) "{"Illegal invocation": alert()}"
Testing: {"Numbers cannot have leading zeroes": 013}
AS OBJECT
-NULL
+string(43) "{"Numbers cannot have leading zeroes": 013}"
AS ARRAY
-NULL
+string(43) "{"Numbers cannot have leading zeroes": 013}"
Testing: {"Numbers cannot be hex": 0x14}
AS OBJECT
-NULL
+string(31) "{"Numbers cannot be hex": 0x14}"
AS ARRAY
-NULL
+string(31) "{"Numbers cannot be hex": 0x14}"
Testing: ["Illegal backslash escape: \x15"]
AS OBJECT
-NULL
+string(34) "["Illegal backslash escape: \x15"]"
AS ARRAY
-NULL
+string(34) "["Illegal backslash escape: \x15"]"
Testing: ["Illegal backslash escape: \'"]
AS OBJECT
-NULL
+string(32) "["Illegal backslash escape: \'"]"
AS ARRAY
-NULL
+string(32) "["Illegal backslash escape: \'"]"
Testing: ["Illegal backslash escape: \017"]
AS OBJECT
-NULL
+string(34) "["Illegal backslash escape: \017"]"
AS ARRAY
-NULL
+string(34) "["Illegal backslash escape: \017"]"
Testing: [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
AS OBJECT
-NULL
+string(50) "[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]"
AS ARRAY
-NULL
+string(50) "[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]"
Testing: {"Missing colon" null}
AS OBJECT
-NULL
+string(22) "{"Missing colon" null}"
AS ARRAY
-NULL
+string(22) "{"Missing colon" null}"
Testing: {"Double colon":: null}
AS OBJECT
-NULL
+string(23) "{"Double colon":: null}"
AS ARRAY
-NULL
+string(23) "{"Double colon":: null}"
Testing: {"Comma instead of colon", null}
AS OBJECT
-NULL
+string(32) "{"Comma instead of colon", null}"
AS ARRAY
-NULL
+string(32) "{"Comma instead of colon", null}"
Testing: ["Colon instead of comma": false]
AS OBJECT
-NULL
+string(33) "["Colon instead of comma": false]"
AS ARRAY
-NULL
+string(33) "["Colon instead of comma": false]"
Testing: ["Bad value", truth]
AS OBJECT
-NULL
+string(20) "["Bad value", truth]"
AS ARRAY
-NULL
+string(20) "["Bad value", truth]"
Testing: ['single quote']
AS OBJECT
-NULL
+string(16) "['single quote']"
AS ARRAY
-NULL
+string(16) "['single quote']"
+--UEXPECT--
+Testing: "A JSON payload should be an object or array, not a string."
+AS OBJECT
+unicode(58) "A JSON payload should be an object or array, not a string."
+AS ARRAY
+unicode(58) "A JSON payload should be an object or array, not a string."
+Testing: ["Unclosed array"
+AS OBJECT
+unicode(17) "["Unclosed array""
+AS ARRAY
+unicode(17) "["Unclosed array""
+Testing: {unquoted_key: "keys must be quoted}
+AS OBJECT
+unicode(36) "{unquoted_key: "keys must be quoted}"
+AS ARRAY
+unicode(36) "{unquoted_key: "keys must be quoted}"
+Testing: ["extra comma",]
+AS OBJECT
+unicode(16) "["extra comma",]"
+AS ARRAY
+unicode(16) "["extra comma",]"
+Testing: ["double extra comma",,]
+AS OBJECT
+unicode(24) "["double extra comma",,]"
+AS ARRAY
+unicode(24) "["double extra comma",,]"
+Testing: [ , "<-- missing value"]
+AS OBJECT
+unicode(26) "[ , "<-- missing value"]"
+AS ARRAY
+unicode(26) "[ , "<-- missing value"]"
+Testing: ["Comma after the close"],
+AS OBJECT
+unicode(26) "["Comma after the close"],"
+AS ARRAY
+unicode(26) "["Comma after the close"],"
+Testing: ["Extra close"]]
+AS OBJECT
+unicode(16) "["Extra close"]]"
+AS ARRAY
+unicode(16) "["Extra close"]]"
+Testing: {"Extra comma": true,}
+AS OBJECT
+unicode(22) "{"Extra comma": true,}"
+AS ARRAY
+unicode(22) "{"Extra comma": true,}"
+Testing: {"Extra value after close": true} "misplaced quoted value"
+AS OBJECT
+unicode(58) "{"Extra value after close": true} "misplaced quoted value""
+AS ARRAY
+unicode(58) "{"Extra value after close": true} "misplaced quoted value""
+Testing: {"Illegal expression": 1 + 2}
+AS OBJECT
+unicode(29) "{"Illegal expression": 1 + 2}"
+AS ARRAY
+unicode(29) "{"Illegal expression": 1 + 2}"
+Testing: {"Illegal invocation": alert()}
+AS OBJECT
+unicode(31) "{"Illegal invocation": alert()}"
+AS ARRAY
+unicode(31) "{"Illegal invocation": alert()}"
+Testing: {"Numbers cannot have leading zeroes": 013}
+AS OBJECT
+unicode(43) "{"Numbers cannot have leading zeroes": 013}"
+AS ARRAY
+unicode(43) "{"Numbers cannot have leading zeroes": 013}"
+Testing: {"Numbers cannot be hex": 0x14}
+AS OBJECT
+unicode(31) "{"Numbers cannot be hex": 0x14}"
+AS ARRAY
+unicode(31) "{"Numbers cannot be hex": 0x14}"
+Testing: ["Illegal backslash escape: \x15"]
+AS OBJECT
+unicode(34) "["Illegal backslash escape: \x15"]"
+AS ARRAY
+unicode(34) "["Illegal backslash escape: \x15"]"
+Testing: ["Illegal backslash escape: \'"]
+AS OBJECT
+unicode(32) "["Illegal backslash escape: \'"]"
+AS ARRAY
+unicode(32) "["Illegal backslash escape: \'"]"
+Testing: ["Illegal backslash escape: \017"]
+AS OBJECT
+unicode(34) "["Illegal backslash escape: \017"]"
+AS ARRAY
+unicode(34) "["Illegal backslash escape: \017"]"
+Testing: [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
+AS OBJECT
+unicode(50) "[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]"
+AS ARRAY
+unicode(50) "[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]"
+Testing: {"Missing colon" null}
+AS OBJECT
+unicode(22) "{"Missing colon" null}"
+AS ARRAY
+unicode(22) "{"Missing colon" null}"
+Testing: {"Double colon":: null}
+AS OBJECT
+unicode(23) "{"Double colon":: null}"
+AS ARRAY
+unicode(23) "{"Double colon":: null}"
+Testing: {"Comma instead of colon", null}
+AS OBJECT
+unicode(32) "{"Comma instead of colon", null}"
+AS ARRAY
+unicode(32) "{"Comma instead of colon", null}"
+Testing: ["Colon instead of comma": false]
+AS OBJECT
+unicode(33) "["Colon instead of comma": false]"
+AS ARRAY
+unicode(33) "["Colon instead of comma": false]"
+Testing: ["Bad value", truth]
+AS OBJECT
+unicode(20) "["Bad value", truth]"
+AS ARRAY
+unicode(20) "["Bad value", truth]"
+Testing: ['single quote']
+AS OBJECT
+unicode(16) "['single quote']"
+AS ARRAY
+unicode(16) "['single quote']"
var_dump($arr);
?>
---EXPECT--
+--EXPECTF--
Testing:
[
"JSON Test Pattern pass1",
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#1 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
}
}
[2]=>
- object(stdClass)#2 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
[7]=>
NULL
[8]=>
- object(stdClass)#3 (36) {
+ object(stdClass)#%d (36) {
["integer"]=>
int(1234567890)
["real"]=>
array(0) {
}
["object"]=>
- object(stdClass)#4 (0) {
+ object(stdClass)#%d (0) {
}
["123"]=>
- object(stdClass)#5 (1) {
+ object(stdClass)#%d (1) {
["456"]=>
- object(stdClass)#6 (1) {
+ object(stdClass)#%d (1) {
["abc"]=>
- object(stdClass)#7 (3) {
+ object(stdClass)#%d (3) {
["789"]=>
string(3) "def"
["012"]=>
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#8 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
}
}
[2]=>
- object(stdClass)#9 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
[7]=>
NULL
[8]=>
- object(stdClass)#10 (36) {
+ object(stdClass)#%d (36) {
["integer"]=>
int(1234567890)
["real"]=>
array(0) {
}
["object"]=>
- object(stdClass)#11 (0) {
+ object(stdClass)#%d (0) {
}
["123"]=>
- object(stdClass)#12 (1) {
+ object(stdClass)#%d (1) {
["456"]=>
- object(stdClass)#13 (1) {
+ object(stdClass)#%d (1) {
["abc"]=>
- object(stdClass)#14 (3) {
+ object(stdClass)#%d (3) {
["789"]=>
string(3) "def"
["012"]=>
[13]=>
string(7) "rosebud"
}
+--UEXPECTF--
+Testing:
+[
+ "JSON Test Pattern pass1",
+ {"object with 1 member":["array with 1 element"]},
+ {},
+ [],
+ -42,
+ true,
+ false,
+ null,
+ {
+ "integer": 1234567890,
+ "real": -9876.543210,
+ "e": 0.123456789e-12,
+ "E": 1.234567890E+34,
+ "": 23456789012E666,
+ "E no .": 4E12,
+ "zero": 0,
+ "one": 1,
+ "space": " ",
+ "quote": "\"",
+ "backslash": "\\",
+ "controls": "\b\f\n\r\t",
+ "slash": "/ & \/",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "digit": "0123456789",
+ "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
+ "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+ "unicode": "\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8",
+ "プレスキット": "プレスキット",
+ "empty_string": "",
+ "true": true,
+ "false": false,
+ "null": null,
+ "array":[ ],
+ "object":{ },
+ "123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},
+ "address": "50 St. James Street",
+ "url": "http://www.JSON.org/",
+ "comment": "// /* <!-- --",
+ "# -- --> */": " ",
+ " s p a c e d " :[1,2 , 3
+
+,
+
+4 , 5 , 6 ,7 ],
+ "compact": [1,2,3,4,5,6,7],
+ "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
+ "quotes": "" \u0022 %22 0x22 034 "",
+ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
+: "A key can be any string"
+ },
+ 0.5 ,98.6
+,
+99.44
+,
+
+1066
+
+
+,"rosebud"]
+
+DECODE: AS OBJECT
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ object(stdClass)#%d (1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ object(stdClass)#%d (36) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ float(INF)
+ [u"E no ."]=>
+ float(4.0E+12)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"unicode"]=>
+ unicode(6) "プレスキット"
+ [u"プレスキット"]=>
+ unicode(6) "プレスキット"
+ [u"empty_string"]=>
+ unicode(0) ""
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ object(stdClass)#%d (0) {
+ }
+ [u"123"]=>
+ object(stdClass)#%d (1) {
+ [u"456"]=>
+ object(stdClass)#%d (1) {
+ [u"abc"]=>
+ object(stdClass)#%d (3) {
+ [u"789"]=>
+ unicode(3) "def"
+ [u"012"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(1) "5"
+ [3]=>
+ int(500)
+ }
+ [u"ghi"]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(4) "five"
+ [3]=>
+ int(50)
+ [4]=>
+ unicode(5) "sixty"
+ }
+ }
+ }
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
+DECODE: AS ARRAY
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ array(1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ array(0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ array(36) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ float(INF)
+ [u"E no ."]=>
+ float(4.0E+12)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"unicode"]=>
+ unicode(6) "プレスキット"
+ [u"プレスキット"]=>
+ unicode(6) "プレスキット"
+ [u"empty_string"]=>
+ unicode(0) ""
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ array(0) {
+ }
+ [123]=>
+ array(1) {
+ [456]=>
+ array(1) {
+ [u"abc"]=>
+ array(3) {
+ [789]=>
+ unicode(3) "def"
+ [u"012"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(1) "5"
+ [3]=>
+ int(500)
+ }
+ [u"ghi"]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(4) "five"
+ [3]=>
+ int(50)
+ [4]=>
+ unicode(5) "sixty"
+ }
+ }
+ }
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
+ENCODE: FROM OBJECT
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":{},"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
+ENCODE: FROM ARRAY
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"E no .":4.0e+12,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","unicode":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8":"\u30d7\u30ec\u30b9\u30ad\u30c3\u30c8","empty_string":"","true":true,"false":false,"null":null,"array":[],"object":[],"123":{"456":{"abc":{"789":"def","012":[1,2,"5",500],"ghi":[1,2,"five",50,"sixty"]}}},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
+DECODE AGAIN: AS OBJECT
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ object(stdClass)#%d (1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ object(stdClass)#%d (36) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ int(0)
+ [u"E no ."]=>
+ float(4.0E+12)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"unicode"]=>
+ unicode(6) "プレスキット"
+ [u"プレスキット"]=>
+ unicode(6) "プレスキット"
+ [u"empty_string"]=>
+ unicode(0) ""
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ object(stdClass)#%d (0) {
+ }
+ [u"123"]=>
+ object(stdClass)#%d (1) {
+ [u"456"]=>
+ object(stdClass)#%d (1) {
+ [u"abc"]=>
+ object(stdClass)#%d (3) {
+ [u"789"]=>
+ unicode(3) "def"
+ [u"012"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(1) "5"
+ [3]=>
+ int(500)
+ }
+ [u"ghi"]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(4) "five"
+ [3]=>
+ int(50)
+ [4]=>
+ unicode(5) "sixty"
+ }
+ }
+ }
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
+DECODE AGAIN: AS ARRAY
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ array(1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ array(0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ array(36) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ int(0)
+ [u"E no ."]=>
+ float(4.0E+12)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"unicode"]=>
+ unicode(6) "プレスキット"
+ [u"プレスキット"]=>
+ unicode(6) "プレスキット"
+ [u"empty_string"]=>
+ unicode(0) ""
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ array(0) {
+ }
+ [123]=>
+ array(1) {
+ [456]=>
+ array(1) {
+ [u"abc"]=>
+ array(3) {
+ [789]=>
+ unicode(3) "def"
+ [u"012"]=>
+ array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(1) "5"
+ [3]=>
+ int(500)
+ }
+ [u"ghi"]=>
+ array(5) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ unicode(4) "five"
+ [3]=>
+ int(50)
+ [4]=>
+ unicode(5) "sixty"
+ }
+ }
+ }
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
var_dump($arr);
?>
---EXPECT--
+--EXPECTF--
Testing:
[
"JSON Test Pattern pass1",
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#1 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
}
}
[2]=>
- object(stdClass)#2 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
[7]=>
NULL
[8]=>
- object(stdClass)#3 (31) {
+ object(stdClass)#%d (31) {
["integer"]=>
int(1234567890)
["real"]=>
array(0) {
}
["object"]=>
- object(stdClass)#4 (0) {
+ object(stdClass)#%d (0) {
}
["address"]=>
string(19) "50 St. James Street"
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#5 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
}
}
[2]=>
- object(stdClass)#6 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
[7]=>
NULL
[8]=>
- object(stdClass)#7 (31) {
+ object(stdClass)#%d (31) {
["integer"]=>
int(1234567890)
["real"]=>
array(0) {
}
["object"]=>
- object(stdClass)#8 (0) {
+ object(stdClass)#%d (0) {
}
["address"]=>
string(19) "50 St. James Street"
[13]=>
string(7) "rosebud"
}
+--UEXPECTF--
+Testing:
+[
+ "JSON Test Pattern pass1",
+ {"object with 1 member":["array with 1 element"]},
+ {},
+ [],
+ -42,
+ true,
+ false,
+ null,
+ {
+ "integer": 1234567890,
+ "real": -9876.543210,
+ "e": 0.123456789e-12,
+ "E": 1.234567890E+34,
+ "": 23456789012E666,
+ "zero": 0,
+ "one": 1,
+ "space": " ",
+ "quote": "\"",
+ "backslash": "\\",
+ "controls": "\b\f\n\r\t",
+ "slash": "/ & \/",
+ "alpha": "abcdefghijklmnopqrstuvwyz",
+ "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
+ "digit": "0123456789",
+ "special": "`1~!@#$%^&*()_+-={':[,]}|;.</>?",
+ "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
+ "true": true,
+ "false": false,
+ "null": null,
+ "array":[ ],
+ "object":{ },
+ "address": "50 St. James Street",
+ "url": "http://www.JSON.org/",
+ "comment": "// /* <!-- --",
+ "# -- --> */": " ",
+ " s p a c e d " :[1,2 , 3
+
+,
+
+4 , 5 , 6 ,7 ],
+ "compact": [1,2,3,4,5,6,7],
+ "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
+ "quotes": "" \u0022 %22 0x22 034 "",
+ "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
+: "A key can be any string"
+ },
+ 0.5 ,98.6
+,
+99.44
+,
+
+1066
+
+
+,"rosebud"]
+
+DECODE: AS OBJECT
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ object(stdClass)#%d (1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ object(stdClass)#%d (31) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ float(INF)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ object(stdClass)#%d (0) {
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
+DECODE: AS ARRAY
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ array(1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ array(0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ array(31) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ float(INF)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ array(0) {
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
+ENCODE: FROM OBJECT
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},{},[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","true":true,"false":false,"null":null,"array":[],"object":{},"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
+ENCODE: FROM ARRAY
+["JSON Test Pattern pass1",{"object with 1 member":["array with 1 element"]},[],[],-42,true,false,null,{"integer":1234567890,"real":-9876.54321,"e":1.23456789e-13,"E":1.23456789e+34,"_empty_":0,"zero":0,"one":1,"space":" ","quote":"\"","backslash":"\\","controls":"\b\f\n\r\t","slash":"\/ & \/","alpha":"abcdefghijklmnopqrstuvwyz","ALPHA":"ABCDEFGHIJKLMNOPQRSTUVWYZ","digit":"0123456789","special":"`1~!@#$%^&*()_+-={':[,]}|;.<\/>?","hex":"\u0123\u4567\u89ab\ucdef\uabcd\uef4a","true":true,"false":false,"null":null,"array":[],"object":[],"address":"50 St. James Street","url":"http:\/\/www.JSON.org\/","comment":"\/\/ \/* <!-- --","# -- --> *\/":" "," s p a c e d ":[1,2,3,4,5,6,7],"compact":[1,2,3,4,5,6,7],"jsontext":"{\"object with 1 member\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034 "","\/\\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',.\/<>?":"A key can be any string"},0.5,98.6,99.44,1066,"rosebud"]
+DECODE AGAIN: AS OBJECT
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ object(stdClass)#%d (1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ object(stdClass)#%d (0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ object(stdClass)#%d (31) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ int(0)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ object(stdClass)#%d (0) {
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
+DECODE AGAIN: AS ARRAY
+array(14) {
+ [0]=>
+ unicode(23) "JSON Test Pattern pass1"
+ [1]=>
+ array(1) {
+ [u"object with 1 member"]=>
+ array(1) {
+ [0]=>
+ unicode(20) "array with 1 element"
+ }
+ }
+ [2]=>
+ array(0) {
+ }
+ [3]=>
+ array(0) {
+ }
+ [4]=>
+ int(-42)
+ [5]=>
+ bool(true)
+ [6]=>
+ bool(false)
+ [7]=>
+ NULL
+ [8]=>
+ array(31) {
+ [u"integer"]=>
+ int(1234567890)
+ [u"real"]=>
+ float(-9876.54321)
+ [u"e"]=>
+ float(1.23456789E-13)
+ [u"E"]=>
+ float(1.23456789E+34)
+ [u"_empty_"]=>
+ int(0)
+ [u"zero"]=>
+ int(0)
+ [u"one"]=>
+ int(1)
+ [u"space"]=>
+ unicode(1) " "
+ [u"quote"]=>
+ unicode(1) """
+ [u"backslash"]=>
+ unicode(1) "\"
+ [u"controls"]=>
+ unicode(5) "\b\f
+
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "`1~!@#$%^&*()_+-={':[,]}|;.</>?"
+ [u"hex"]=>
+ unicode(6) "ģ䕧覫췯ꯍ"
+ [u"true"]=>
+ bool(true)
+ [u"false"]=>
+ bool(false)
+ [u"null"]=>
+ NULL
+ [u"array"]=>
+ array(0) {
+ }
+ [u"object"]=>
+ array(0) {
+ }
+ [u"address"]=>
+ unicode(19) "50 St. James Street"
+ [u"url"]=>
+ unicode(20) "http://www.JSON.org/"
+ [u"comment"]=>
+ unicode(13) "// /* <!-- --"
+ [u"# -- --> */"]=>
+ unicode(1) " "
+ [u" s p a c e d "]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"compact"]=>
+ array(7) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+ [4]=>
+ int(5)
+ [5]=>
+ int(6)
+ [6]=>
+ int(7)
+ }
+ [u"jsontext"]=>
+ unicode(49) "{"object with 1 member":["array with 1 element"]}"
+ [u"quotes"]=>
+ unicode(27) "" " %22 0x22 034 ""
+ [u"/\"쫾몾ꮘﳞ볚\b\f
+
+ `1~!@#$%^&*()_+-=[]{}|;:',./<>?"]=>
+ unicode(23) "A key can be any string"
+ }
+ [9]=>
+ float(0.5)
+ [10]=>
+ float(98.6)
+ [11]=>
+ float(99.44)
+ [12]=>
+ int(1066)
+ [13]=>
+ unicode(7) "rosebud"
+}
}
}
}
+--UEXPECT--
+Testing: [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
+DECODE: AS OBJECT
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ unicode(12) "Not too deep"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+DECODE: AS ARRAY
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ unicode(12) "Not too deep"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+ENCODE: FROM OBJECT
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
+ENCODE: FROM ARRAY
+[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
+DECODE AGAIN: AS OBJECT
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ unicode(12) "Not too deep"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+DECODE AGAIN: AS ARRAY
+array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ array(1) {
+ [0]=>
+ unicode(12) "Not too deep"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
var_dump($arr);
?>
---EXPECT--
+--EXPECTF--
Testing:
{
"JSON Test Pattern pass3": {
}
DECODE: AS OBJECT
-object(stdClass)#1 (1) {
+object(stdClass)#%d (1) {
["JSON Test Pattern pass3"]=>
- object(stdClass)#2 (2) {
+ object(stdClass)#%d (2) {
["The outermost value"]=>
string(27) "must be an object or array."
["In this test"]=>
ENCODE: FROM ARRAY
{"JSON Test Pattern pass3":{"The outermost value":"must be an object or array.","In this test":"It is an object."}}
DECODE AGAIN: AS OBJECT
-object(stdClass)#3 (1) {
+object(stdClass)#%d (1) {
["JSON Test Pattern pass3"]=>
- object(stdClass)#4 (2) {
+ object(stdClass)#%d (2) {
["The outermost value"]=>
string(27) "must be an object or array."
["In this test"]=>
string(16) "It is an object."
}
}
+--UEXPECTF--
+Testing:
+{
+ "JSON Test Pattern pass3": {
+ "The outermost value": "must be an object or array.",
+ "In this test": "It is an object."
+ }
+}
+
+DECODE: AS OBJECT
+object(stdClass)#%d (1) {
+ [u"JSON Test Pattern pass3"]=>
+ object(stdClass)#%d (2) {
+ [u"The outermost value"]=>
+ unicode(27) "must be an object or array."
+ [u"In this test"]=>
+ unicode(16) "It is an object."
+ }
+}
+DECODE: AS ARRAY
+array(1) {
+ [u"JSON Test Pattern pass3"]=>
+ array(2) {
+ [u"The outermost value"]=>
+ unicode(27) "must be an object or array."
+ [u"In this test"]=>
+ unicode(16) "It is an object."
+ }
+}
+ENCODE: FROM OBJECT
+{"JSON Test Pattern pass3":{"The outermost value":"must be an object or array.","In this test":"It is an object."}}
+ENCODE: FROM ARRAY
+{"JSON Test Pattern pass3":{"The outermost value":"must be an object or array.","In this test":"It is an object."}}
+DECODE AGAIN: AS OBJECT
+object(stdClass)#%d (1) {
+ [u"JSON Test Pattern pass3"]=>
+ object(stdClass)#%d (2) {
+ [u"The outermost value"]=>
+ unicode(27) "must be an object or array."
+ [u"In this test"]=>
+ unicode(16) "It is an object."
+ }
+}
+DECODE AGAIN: AS ARRAY
+array(1) {
+ [u"JSON Test Pattern pass3"]=>
+ array(2) {
+ [u"The outermost value"]=>
+ unicode(27) "must be an object or array."
+ [u"In this test"]=>
+ unicode(16) "It is an object."
+ }
+}