tony2001 Thu Oct 19 20:17:17 2006 UTC
Modified files:
/php-src/ext/json/tests 001.phpt 004.phpt 005.phpt fail001.phpt
pass001.1.phpt pass001.phpt pass002.phpt
pass003.phpt
Log:
fix tests
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/001.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/json/tests/001.phpt
diff -u php-src/ext/json/tests/001.phpt:1.3 php-src/ext/json/tests/001.phpt:1.4
--- php-src/ext/json/tests/001.phpt:1.3 Mon Aug 7 21:51:06 2006
+++ php-src/ext/json/tests/001.phpt Thu Oct 19 20:17:17 2006
@@ -31,43 +31,43 @@
NULL
NULL
NULL
+string(1) "."
+string(1) "."
+string(3) "<?>"
+string(1) ";"
+string(12) "ÑÑÑÑиÑ"
+string(4) "blah"
NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-NULL
-object(stdClass)#1 (1) {
+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
@@ -75,41 +75,41 @@
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
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/004.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/json/tests/004.phpt
diff -u php-src/ext/json/tests/004.phpt:1.2 php-src/ext/json/tests/004.phpt:1.3
--- php-src/ext/json/tests/004.phpt:1.2 Thu Jul 20 09:33:15 2006
+++ php-src/ext/json/tests/004.phpt Thu Oct 19 20:17:17 2006
@@ -25,3 +25,15 @@
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
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/005.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/json/tests/005.phpt
diff -u php-src/ext/json/tests/005.phpt:1.2 php-src/ext/json/tests/005.phpt:1.3
--- php-src/ext/json/tests/005.phpt:1.2 Thu Jul 20 09:33:15 2006
+++ php-src/ext/json/tests/005.phpt Thu Oct 19 20:17:17 2006
@@ -25,3 +25,15 @@
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
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/fail001.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/json/tests/fail001.phpt
diff -u php-src/ext/json/tests/fail001.phpt:1.2
php-src/ext/json/tests/fail001.phpt:1.3
--- php-src/ext/json/tests/fail001.phpt:1.2 Mon Aug 7 23:33:57 2006
+++ php-src/ext/json/tests/fail001.phpt Thu Oct 19 20:17:17 2006
@@ -45,121 +45,242 @@
--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']"
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass001.1.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/json/tests/pass001.1.phpt
diff -u php-src/ext/json/tests/pass001.1.phpt:1.4
php-src/ext/json/tests/pass001.1.phpt:1.5
--- php-src/ext/json/tests/pass001.1.phpt:1.4 Mon Aug 7 23:33:57 2006
+++ php-src/ext/json/tests/pass001.1.phpt Thu Oct 19 20:17:17 2006
@@ -101,7 +101,7 @@
var_dump($arr);
?>
---EXPECT--
+--EXPECTF--
Testing:
[
"JSON Test Pattern pass1",
@@ -170,7 +170,7 @@
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#1 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
@@ -178,7 +178,7 @@
}
}
[2]=>
- object(stdClass)#2 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
@@ -192,7 +192,7 @@
[7]=>
NULL
[8]=>
- object(stdClass)#3 (36) {
+ object(stdClass)#%d (36) {
["integer"]=>
int(1234567890)
["real"]=>
@@ -246,14 +246,14 @@
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"]=>
@@ -532,7 +532,7 @@
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#8 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
@@ -540,7 +540,7 @@
}
}
[2]=>
- object(stdClass)#9 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
@@ -554,7 +554,7 @@
[7]=>
NULL
[8]=>
- object(stdClass)#10 (36) {
+ object(stdClass)#%d (36) {
["integer"]=>
int(1234567890)
["real"]=>
@@ -608,14 +608,14 @@
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"]=>
@@ -885,3 +885,787 @@
[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": "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?",
+ "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 "",
+ "\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"
+: "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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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":"[EMAIL
PROTECTED]&*()_+-={':[,]}|;.<\/>?","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 me!
mber\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034
"","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"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":"[EMAIL
PROTECTED]&*()_+-={':[,]}|;.<\/>?","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 me!
mber\":[\"array with 1 element\"]}","quotes":"" \" %22 0x22 034
"","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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"
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass001.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/json/tests/pass001.phpt
diff -u php-src/ext/json/tests/pass001.phpt:1.2
php-src/ext/json/tests/pass001.phpt:1.3
--- php-src/ext/json/tests/pass001.phpt:1.2 Mon Aug 7 23:33:57 2006
+++ php-src/ext/json/tests/pass001.phpt Thu Oct 19 20:17:17 2006
@@ -91,7 +91,7 @@
var_dump($arr);
?>
---EXPECT--
+--EXPECTF--
Testing:
[
"JSON Test Pattern pass1",
@@ -155,7 +155,7 @@
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#1 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
@@ -163,7 +163,7 @@
}
}
[2]=>
- object(stdClass)#2 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
@@ -177,7 +177,7 @@
[7]=>
NULL
[8]=>
- object(stdClass)#3 (31) {
+ object(stdClass)#%d (31) {
["integer"]=>
int(1234567890)
["real"]=>
@@ -223,7 +223,7 @@
array(0) {
}
["object"]=>
- object(stdClass)#4 (0) {
+ object(stdClass)#%d (0) {
}
["address"]=>
string(19) "50 St. James Street"
@@ -431,7 +431,7 @@
[0]=>
string(23) "JSON Test Pattern pass1"
[1]=>
- object(stdClass)#5 (1) {
+ object(stdClass)#%d (1) {
["object with 1 member"]=>
array(1) {
[0]=>
@@ -439,7 +439,7 @@
}
}
[2]=>
- object(stdClass)#6 (0) {
+ object(stdClass)#%d (0) {
}
[3]=>
array(0) {
@@ -453,7 +453,7 @@
[7]=>
NULL
[8]=>
- object(stdClass)#7 (31) {
+ object(stdClass)#%d (31) {
["integer"]=>
int(1234567890)
["real"]=>
@@ -499,7 +499,7 @@
array(0) {
}
["object"]=>
- object(stdClass)#8 (0) {
+ object(stdClass)#%d (0) {
}
["address"]=>
string(19) "50 St. James Street"
@@ -698,3 +698,610 @@
[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": "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?",
+ "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 "",
+ "\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"
+: "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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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":"[EMAIL
PROTECTED]&*()_+-={':[,]}|;.<\/>?","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
"","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"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":"[EMAIL
PROTECTED]&*()_+-={':[,]}|;.<\/>?","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
"","\/\\\"[EMAIL PROTECTED]&*()_+-=[]{}|;:',.\/<>?":"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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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) "
+ "
+ [u"slash"]=>
+ unicode(5) "/ & /"
+ [u"alpha"]=>
+ unicode(25) "abcdefghijklmnopqrstuvwyz"
+ [u"ALPHA"]=>
+ unicode(25) "ABCDEFGHIJKLMNOPQRSTUVWYZ"
+ [u"digit"]=>
+ unicode(10) "0123456789"
+ [u"special"]=>
+ unicode(31) "[EMAIL PROTECTED]&*()_+-={':[,]}|;.</>?"
+ [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"/\"쫾몾ê®ï³ë³î½
+ [EMAIL PROTECTED]&*()_+-=[]{}|;:',./<>?"]=>
+ 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"
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass002.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/json/tests/pass002.phpt
diff -u php-src/ext/json/tests/pass002.phpt:1.2
php-src/ext/json/tests/pass002.phpt:1.3
--- php-src/ext/json/tests/pass002.phpt:1.2 Mon Aug 7 23:33:57 2006
+++ php-src/ext/json/tests/pass002.phpt Thu Oct 19 20:17:17 2006
@@ -273,3 +273,245 @@
}
}
}
+--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"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/pass003.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/json/tests/pass003.phpt
diff -u php-src/ext/json/tests/pass003.phpt:1.2
php-src/ext/json/tests/pass003.phpt:1.3
--- php-src/ext/json/tests/pass003.phpt:1.2 Mon Aug 7 23:33:57 2006
+++ php-src/ext/json/tests/pass003.phpt Thu Oct 19 20:17:17 2006
@@ -39,7 +39,7 @@
var_dump($arr);
?>
---EXPECT--
+--EXPECTF--
Testing:
{
"JSON Test Pattern pass3": {
@@ -49,9 +49,9 @@
}
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"]=>
@@ -73,9 +73,9 @@
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"]=>
@@ -92,3 +92,56 @@
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."
+ }
+}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php