]> granicus.if.org Git - php/commitdiff
fix tests
authorAntony Dovgal <tony2001@php.net>
Thu, 19 Oct 2006 20:17:17 +0000 (20:17 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 19 Oct 2006 20:17:17 +0000 (20:17 +0000)
ext/json/tests/001.phpt
ext/json/tests/004.phpt
ext/json/tests/005.phpt
ext/json/tests/fail001.phpt
ext/json/tests/pass001.1.phpt
ext/json/tests/pass001.phpt
ext/json/tests/pass002.phpt
ext/json/tests/pass003.phpt

index 04153776475aff3e3654ff08cf5b0a3ccf2cd0d6..c210b8dec72313485d2686b9c41641e1683bc495 100644 (file)
@@ -31,43 +31,43 @@ NULL
 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
@@ -75,41 +75,41 @@ NULL
 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
index 884d874205473549c158158bc40713a96cda6cda..348d1c735e6a335859b00d0d0c95ba32f38d87ee 100644 (file)
@@ -25,3 +25,15 @@ object(stdClass)#%d (1) {
 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
index f6a8977d184f183221083366d5400ce95095f978..2845dd3ebb2b05c83d13382388cea74d1773eb21 100644 (file)
@@ -25,3 +25,15 @@ array(1) {
 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
index f0e0afa387b26f96e9c8e77946961eb302cb7ba8..3ea1a2bb015b7e43c588052712dd8f589f90e9d5 100644 (file)
@@ -45,121 +45,242 @@ foreach ($tests as $test)
 --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']"
index 87766e912cd038ecea3b0f7ade651062145d4b47..758764e2be8aaf2199394577566de207e782f89a 100644 (file)
@@ -101,7 +101,7 @@ $arr = json_decode($arr_enc, true);
 var_dump($arr);
 
 ?>
---EXPECT--
+--EXPECTF--
 Testing: 
 [
     "JSON Test Pattern pass1",
@@ -170,7 +170,7 @@ array(14) {
   [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 @@ array(14) {
     }
   }
   [2]=>
-  object(stdClass)#2 (0) {
+  object(stdClass)#%d (0) {
   }
   [3]=>
   array(0) {
@@ -192,7 +192,7 @@ array(14) {
   [7]=>
   NULL
   [8]=>
-  object(stdClass)#3 (36) {
+  object(stdClass)#%d (36) {
     ["integer"]=>
     int(1234567890)
     ["real"]=>
@@ -247,14 +247,14 @@ array(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"]=>
@@ -536,7 +536,7 @@ array(14) {
   [0]=>
   string(23) "JSON Test Pattern pass1"
   [1]=>
-  object(stdClass)#8 (1) {
+  object(stdClass)#%d (1) {
     ["object with 1 member"]=>
     array(1) {
       [0]=>
@@ -544,7 +544,7 @@ array(14) {
     }
   }
   [2]=>
-  object(stdClass)#9 (0) {
+  object(stdClass)#%d (0) {
   }
   [3]=>
   array(0) {
@@ -558,7 +558,7 @@ array(14) {
   [7]=>
   NULL
   [8]=>
-  object(stdClass)#10 (36) {
+  object(stdClass)#%d (36) {
     ["integer"]=>
     int(1234567890)
     ["real"]=>
@@ -613,14 +613,14 @@ array(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"]=>
@@ -893,3 +893,795 @@ array(14) {
   [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": "&#34; \u0022 %22 0x22 034 &#x22;",
+        "\/\\\"\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) "&#34; " %22 0x22 034 &#x22;"
+    [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) "&#34; " %22 0x22 034 &#x22;"
+    [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":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\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":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\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) "&#34; " %22 0x22 034 &#x22;"
+    [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) "&#34; " %22 0x22 034 &#x22;"
+    [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"
+}
index f2aba683b06a0871be1ffaf1442350822d8cef76..a25c4bf48c0df3dd23479df6d3cee843b3a8e86b 100644 (file)
@@ -91,7 +91,7 @@ $arr = json_decode($arr_enc, true);
 var_dump($arr);
 
 ?>
---EXPECT--
+--EXPECTF--
 Testing: 
 [
     "JSON Test Pattern pass1",
@@ -155,7 +155,7 @@ array(14) {
   [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 @@ array(14) {
     }
   }
   [2]=>
-  object(stdClass)#2 (0) {
+  object(stdClass)#%d (0) {
   }
   [3]=>
   array(0) {
@@ -177,7 +177,7 @@ array(14) {
   [7]=>
   NULL
   [8]=>
-  object(stdClass)#3 (31) {
+  object(stdClass)#%d (31) {
     ["integer"]=>
     int(1234567890)
     ["real"]=>
@@ -224,7 +224,7 @@ array(14) {
     array(0) {
     }
     ["object"]=>
-    object(stdClass)#4 (0) {
+    object(stdClass)#%d (0) {
     }
     ["address"]=>
     string(19) "50 St. James Street"
@@ -435,7 +435,7 @@ array(14) {
   [0]=>
   string(23) "JSON Test Pattern pass1"
   [1]=>
-  object(stdClass)#5 (1) {
+  object(stdClass)#%d (1) {
     ["object with 1 member"]=>
     array(1) {
       [0]=>
@@ -443,7 +443,7 @@ array(14) {
     }
   }
   [2]=>
-  object(stdClass)#6 (0) {
+  object(stdClass)#%d (0) {
   }
   [3]=>
   array(0) {
@@ -457,7 +457,7 @@ array(14) {
   [7]=>
   NULL
   [8]=>
-  object(stdClass)#7 (31) {
+  object(stdClass)#%d (31) {
     ["integer"]=>
     int(1234567890)
     ["real"]=>
@@ -504,7 +504,7 @@ array(14) {
     array(0) {
     }
     ["object"]=>
-    object(stdClass)#8 (0) {
+    object(stdClass)#%d (0) {
     }
     ["address"]=>
     string(19) "50 St. James Street"
@@ -706,3 +706,618 @@ array(14) {
   [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": "&#34; \u0022 %22 0x22 034 &#x22;",
+        "\/\\\"\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) "&#34; " %22 0x22 034 &#x22;"
+    [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) "&#34; " %22 0x22 034 &#x22;"
+    [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":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\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":"&#34; \" %22 0x22 034 &#x22;","\/\\\"\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) "&#34; " %22 0x22 034 &#x22;"
+    [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) "&#34; " %22 0x22 034 &#x22;"
+    [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"
+}
index 24c7e3358003463939246b1a8d9eb9333207dbaf..8a6542ef5ad52d82d32e88af769b24f17ebbb36b 100644 (file)
@@ -273,3 +273,245 @@ array(1) {
     }
   }
 }
+--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"
+                                    }
+                                  }
+                                }
+                              }
+                            }
+                          }
+                        }
+                      }
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+}
index 36da4a1de6a11edc4a53937482c50a5aa577baae..066621e2042c1055ff62bdd0fd3690078322b6b0 100644 (file)
@@ -39,7 +39,7 @@ $arr = json_decode($arr_enc, true);
 var_dump($arr);
 
 ?>
---EXPECT--
+--EXPECTF--
 Testing: 
 {
     "JSON Test Pattern pass3": {
@@ -49,9 +49,9 @@ Testing:
 }
 
 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 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)#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 @@ array(1) {
     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."
+  }
+}