diff --git a/hphp/test/zend/bad/ext-json/001.php b/hphp/test/zend/bad/ext-json/001.php new file mode 100644 index 000000000..1d655c0b3 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/001.php @@ -0,0 +1,22 @@ +")); +var_dump(json_decode(";")); +var_dump(json_decode("руссиш")); +var_dump(json_decode("blah")); +var_dump(json_decode(NULL)); +var_dump(json_decode('{ "test": { "foo": "bar" } }')); +var_dump(json_decode('{ "test": { "foo": "" } }')); +var_dump(json_decode('{ "": { "foo": "" } }')); +var_dump(json_decode('{ "": { "": "" } }')); +var_dump(json_decode('{ "": { "": "" }')); +var_dump(json_decode('{ "": "": "" } }')); + +?> +===DONE=== \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/001.php.expectf b/hphp/test/zend/bad/ext-json/001.php.expectf new file mode 100644 index 000000000..59b9c2743 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/001.php.expectf @@ -0,0 +1,43 @@ +HipHop Warning: %a +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +NULL +object(stdClass)#%d (1) { + ["test"]=> + object(stdClass)#%d (1) { + ["foo"]=> + string(3) "bar" + } +} +object(stdClass)#%d (1) { + ["test"]=> + object(stdClass)#%d (1) { + ["foo"]=> + string(0) "" + } +} +object(stdClass)#%d (1) { + ["_empty_"]=> + object(stdClass)#%d (1) { + ["foo"]=> + string(0) "" + } +} +object(stdClass)#%d (1) { + ["_empty_"]=> + object(stdClass)#%d (1) { + ["_empty_"]=> + string(0) "" + } +} +NULL +NULL +===DONE=== \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/007.php b/hphp/test/zend/bad/ext-json/007.php new file mode 100644 index 000000000..6efb75a1d --- /dev/null +++ b/hphp/test/zend/bad/ext-json/007.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/007.php.expectf b/hphp/test/zend/bad/ext-json/007.php.expectf new file mode 100644 index 000000000..853cf5efa --- /dev/null +++ b/hphp/test/zend/bad/ext-json/007.php.expectf @@ -0,0 +1,14 @@ +array(1) { + [0]=> + int(1) +} +int(0) +NULL +int(1) +NULL +int(2) +NULL +int(3) +NULL +int(4) +Done \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/008.php b/hphp/test/zend/bad/ext-json/008.php new file mode 100644 index 000000000..d2e762117 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/008.php @@ -0,0 +1,8 @@ +largenum); +$x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING); +var_dump($x->largenum); +echo "Done\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/008.php.expectf b/hphp/test/zend/bad/ext-json/008.php.expectf new file mode 100644 index 000000000..e2caac8b0 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/008.php.expectf @@ -0,0 +1,3 @@ +float(1.2345678901235E+29) +string(30) "123456789012345678901234567890" +Done \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug42090.php b/hphp/test/zend/bad/ext-json/bug42090.php new file mode 100644 index 000000000..7de0e98d2 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug42090.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug42090.php.expectf b/hphp/test/zend/bad/ext-json/bug42090.php.expectf new file mode 100644 index 000000000..39941c718 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug42090.php.expectf @@ -0,0 +1,7 @@ +string(0) "" +NULL +NULL +NULL +string(4) ""\""" +string(1) """ +string(2) """" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug45791.php b/hphp/test/zend/bad/ext-json/bug45791.php new file mode 100644 index 000000000..bc146ba2c --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug45791.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug45791.php.expectf b/hphp/test/zend/bad/ext-json/bug45791.php.expectf new file mode 100644 index 000000000..fb35859c9 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug45791.php.expectf @@ -0,0 +1,4 @@ +object(stdClass)#1 (1) { + ["zero"]=> + float(0) +} \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug53946.php b/hphp/test/zend/bad/ext-json/bug53946.php new file mode 100644 index 000000000..3116c1d5b --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug53946.php @@ -0,0 +1,6 @@ +𝄞<")); +var_dump(json_encode("latin 1234 -/ russian мама мыла раму specialchars \x02 \x08 \n U+1D11E >𝄞<", JSON_UNESCAPED_UNICODE)); +var_dump(json_encode("ab\xE0")); +var_dump(json_encode("ab\xE0", JSON_UNESCAPED_UNICODE)); +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug53946.php.expectf b/hphp/test/zend/bad/ext-json/bug53946.php.expectf new file mode 100644 index 000000000..d7cdbbfc1 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug53946.php.expectf @@ -0,0 +1,4 @@ +string(156) ""latin 1234 -\/ russian \u043c\u0430\u043c\u0430 \u043c\u044b\u043b\u0430 \u0440\u0430\u043c\u0443 specialchars \u0002 \b \n U+1D11E >\ud834\udd1e<"" +string(100) ""latin 1234 -\/ russian мама мыла раму specialchars \u0002 \b \n U+1D11E >𝄞<"" +string(4) "null" +string(4) "null" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug54058.php b/hphp/test/zend/bad/ext-json/bug54058.php new file mode 100644 index 000000000..1d6627156 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug54058.php @@ -0,0 +1,25 @@ +foo = quoted_printable_decode('=B0'); +json_encode($a); +var_dump(json_last_error()); + +$b = new stdclass; +$b->foo = $bad_utf8; +$b->bar = 1; +json_encode($b); +var_dump(json_last_error()); + +$c = array( + 'foo' => $bad_utf8, + 'bar' => 1 +); +json_encode($c); +var_dump(json_last_error()); +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug54058.php.expectf b/hphp/test/zend/bad/ext-json/bug54058.php.expectf new file mode 100644 index 000000000..e9636d121 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug54058.php.expectf @@ -0,0 +1,4 @@ +int(5) +int(5) +int(5) +int(5) \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug54484.php b/hphp/test/zend/bad/ext-json/bug54484.php new file mode 100644 index 000000000..26390b7fd --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug54484.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug54484.php.expectf b/hphp/test/zend/bad/ext-json/bug54484.php.expectf new file mode 100644 index 000000000..dda7d3f84 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug54484.php.expectf @@ -0,0 +1,4 @@ +int(0) +int(0) +int(4) +int(0) \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug55543.php b/hphp/test/zend/bad/ext-json/bug55543.php new file mode 100644 index 000000000..ac66881da --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug55543.php @@ -0,0 +1,6 @@ +{"1"} = "5"; + +var_dump(json_encode($a, JSON_NUMERIC_CHECK)); +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug55543.php.expectf b/hphp/test/zend/bad/ext-json/bug55543.php.expectf new file mode 100644 index 000000000..187d5a71d --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug55543.php.expectf @@ -0,0 +1 @@ +string(7) "{"1":5}" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug61978.php b/hphp/test/zend/bad/ext-json/bug61978.php new file mode 100644 index 000000000..569cb268a --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug61978.php @@ -0,0 +1,34 @@ +test = '123'; + $this->me = $this; + } +} + +class JsonTest2 implements JsonSerializable { + public $test; + public function __construct() { + $this->test = '123'; + } + public function jsonSerialize() { + return array( + 'test' => $this->test, + 'me' => $this + ); + } +} + + +$obj1 = new JsonTest1(); +var_dump(json_encode($obj1)); + +echo "\n==\n"; + +$obj2 = new JsonTest2(); +var_dump(json_encode($obj2)); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug61978.php.expectf b/hphp/test/zend/bad/ext-json/bug61978.php.expectf new file mode 100644 index 000000000..adfdaa834 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug61978.php.expectf @@ -0,0 +1,6 @@ +HipHop Warning: %a +string(44) "{"test":"123","me":{"test":"123","me":null}}" + +== +HipHop Warning: %a +string(44) "{"test":"123","me":{"test":"123","me":null}}" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug63737.php b/hphp/test/zend/bad/ext-json/bug63737.php new file mode 100644 index 000000000..cb0c8c690 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug63737.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/bug63737.php.expectf b/hphp/test/zend/bad/ext-json/bug63737.php.expectf new file mode 100644 index 000000000..46c9b0c8d --- /dev/null +++ b/hphp/test/zend/bad/ext-json/bug63737.php.expectf @@ -0,0 +1,9 @@ +float(1.2345678901235E+29) +string(30) "123456789012345678901234567890" +float(-1.2345678901235E+29) +string(31) "-123456789012345678901234567890" +float(1.2345678901235E+29) +float(1.2345678901235E+29) +float(-1.2345678901235E+29) +float(-1.2345678901235E+29) +Done \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/json_decode_basic.php b/hphp/test/zend/bad/ext-json/json_decode_basic.php new file mode 100644 index 000000000..ad60ac8fe --- /dev/null +++ b/hphp/test/zend/bad/ext-json/json_decode_basic.php @@ -0,0 +1,42 @@ + +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/json_decode_basic.php.expectf b/hphp/test/zend/bad/ext-json/json_decode_basic.php.expectf new file mode 100644 index 000000000..8fc136a1a --- /dev/null +++ b/hphp/test/zend/bad/ext-json/json_decode_basic.php.expectf @@ -0,0 +1,135 @@ +*** Testing json_decode() : basic functionality *** +-- Iteration 1 -- +int(0) +int(0) +-- Iteration 2 -- +int(123) +int(123) +-- Iteration 3 -- +int(-123) +int(-123) +-- Iteration 4 -- +int(2147483647) +int(2147483647) +-- Iteration 5 -- +int(-2147483648) +int(-2147483648) +-- Iteration 6 -- +float(123.456) +float(123.456) +-- Iteration 7 -- +int(1230) +int(1230) +-- Iteration 8 -- +int(-1230) +int(-1230) +-- Iteration 9 -- +bool(true) +bool(true) +-- Iteration 10 -- +bool(false) +bool(false) +-- Iteration 11 -- +NULL +NULL +-- Iteration 12 -- +string(3) "abc" +string(3) "abc" +-- Iteration 13 -- +string(13) "Hello World +" +string(13) "Hello World +" +-- Iteration 14 -- +array(0) { +} +array(0) { +} +-- Iteration 15 -- +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +array(5) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + [3]=> + int(4) + [4]=> + int(5) +} +-- Iteration 16 -- +object(stdClass)#%d (5) { + ["myInt"]=> + int(99) + ["myFloat"]=> + float(123.45) + ["myNull"]=> + NULL + ["myBool"]=> + bool(true) + ["myString"]=> + string(11) "Hello World" +} +array(5) { + ["myInt"]=> + int(99) + ["myFloat"]=> + float(123.45) + ["myNull"]=> + NULL + ["myBool"]=> + bool(true) + ["myString"]=> + string(11) "Hello World" +} +-- Iteration 17 -- +object(stdClass)#%d (6) { + ["Jan"]=> + int(31) + ["Feb"]=> + int(29) + ["Mar"]=> + int(31) + ["April"]=> + int(30) + ["May"]=> + int(31) + ["June"]=> + int(30) +} +array(6) { + ["Jan"]=> + int(31) + ["Feb"]=> + int(29) + ["Mar"]=> + int(31) + ["April"]=> + int(30) + ["May"]=> + int(31) + ["June"]=> + int(30) +} +-- Iteration 18 -- +string(0) "" +string(0) "" +-- Iteration 19 -- +object(stdClass)#%d (0) { +} +array(0) { +} +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/json_encode_basic.php b/hphp/test/zend/bad/ext-json/json_encode_basic.php new file mode 100644 index 000000000..bd91cd251 --- /dev/null +++ b/hphp/test/zend/bad/ext-json/json_encode_basic.php @@ -0,0 +1,90 @@ +MyInt = 99; +$obj->MyFloat = 123.45; +$obj->MyBool = true; +$obj->MyNull = null; +$obj->MyString = "Hello World"; + +// array with different values for $string +$inputs = array ( + + // integers +/*1*/ 0, + 123, + -123, + 2147483647, + -2147483648, + + // floats +/*6*/ 123.456, + 1.23E3, + -1.23E3, + + // boolean +/*9*/ TRUE, + true, + FALSE, + false, + + // NULL +/*13*/ NULL, + null, + + // strings +/*15*/ "abc", + 'abc', + "Hello\t\tWorld\n", + + // arrays +/*18*/ array(), + array(1,2,3,4,5), + array(1 => "Sun", 2=>"Mon", 3 => "Tue", 4 => "Wed", 5 => "Thur", 6 => "Fri", 7 => "Sat"), + array("Jan" => 31, "Feb" => 29, "Mar" => 31, "April" => 30, "May" => 31, "June" => 30), + + // empty data +/*22*/ "", + '', + + // undefined data +/*24*/ @$undefined_var, + + // unset data +/*25*/ @$unset_var, + + // resource variable +/*26*/ $fp, + + // object variable +/*27*/ $obj + +); + +// loop through with each element of the $inputs array to test json_encode() function +$count = 1; +foreach($inputs as $input) { + echo "-- Iteration $count --\n"; + var_dump(json_encode($input)); + $count ++; +} + +?> +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-json/json_encode_basic.php.expectf b/hphp/test/zend/bad/ext-json/json_encode_basic.php.expectf new file mode 100644 index 000000000..a135444fb --- /dev/null +++ b/hphp/test/zend/bad/ext-json/json_encode_basic.php.expectf @@ -0,0 +1,57 @@ +*** Testing json_encode() : basic functionality *** +-- Iteration 1 -- +string(1) "0" +-- Iteration 2 -- +string(3) "123" +-- Iteration 3 -- +string(4) "-123" +-- Iteration 4 -- +string(10) "2147483647" +-- Iteration 5 -- +string(11) "-2147483648" +-- Iteration 6 -- +string(7) "123.456" +-- Iteration 7 -- +string(4) "1230" +-- Iteration 8 -- +string(5) "-1230" +-- Iteration 9 -- +string(4) "true" +-- Iteration 10 -- +string(4) "true" +-- Iteration 11 -- +string(5) "false" +-- Iteration 12 -- +string(5) "false" +-- Iteration 13 -- +string(4) "null" +-- Iteration 14 -- +string(4) "null" +-- Iteration 15 -- +string(5) ""abc"" +-- Iteration 16 -- +string(5) ""abc"" +-- Iteration 17 -- +string(18) ""Hello\t\tWorld\n"" +-- Iteration 18 -- +string(2) "[]" +-- Iteration 19 -- +string(11) "[1,2,3,4,5]" +-- Iteration 20 -- +string(72) "{"1":"Sun","2":"Mon","3":"Tue","4":"Wed","5":"Thur","6":"Fri","7":"Sat"}" +-- Iteration 21 -- +string(58) "{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}" +-- Iteration 22 -- +string(2) """" +-- Iteration 23 -- +string(2) """" +-- Iteration 24 -- +string(4) "null" +-- Iteration 25 -- +string(4) "null" +-- Iteration 26 -- +HipHop Warning: %a +string(4) "null" +-- Iteration 27 -- +string(82) "{"MyInt":99,"MyFloat":123.45,"MyBool":true,"MyNull":null,"MyString":"Hello World"}" +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/002.php b/hphp/test/zend/good/ext-json/002.php new file mode 100644 index 000000000..a60fbe5a0 --- /dev/null +++ b/hphp/test/zend/good/ext-json/002.php @@ -0,0 +1,20 @@ +""))); +var_dump(json_encode(array(array(1)))); +var_dump(json_encode(array())); + +var_dump(json_encode(array(""=>""), JSON_FORCE_OBJECT)); +var_dump(json_encode(array(array(1)), JSON_FORCE_OBJECT)); +var_dump(json_encode(array(), JSON_FORCE_OBJECT)); + +var_dump(json_encode(1)); +var_dump(json_encode("руссиш")); + + +echo "Done\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/002.php.expectf b/hphp/test/zend/good/ext-json/002.php.expectf new file mode 100644 index 000000000..f5ca75f78 --- /dev/null +++ b/hphp/test/zend/good/ext-json/002.php.expectf @@ -0,0 +1,12 @@ +string(2) """" +string(4) "null" +string(4) "true" +string(7) "{"":""}" +string(5) "[[1]]" +string(2) "[]" +string(7) "{"":""}" +string(13) "{"0":{"0":1}}" +string(2) "{}" +string(1) "1" +string(38) ""\u0440\u0443\u0441\u0441\u0438\u0448"" +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/003.php b/hphp/test/zend/good/ext-json/003.php new file mode 100644 index 000000000..208334bca --- /dev/null +++ b/hphp/test/zend/good/ext-json/003.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/003.php.expectf b/hphp/test/zend/good/ext-json/003.php.expectf new file mode 100644 index 000000000..9cc8ea1e6 --- /dev/null +++ b/hphp/test/zend/good/ext-json/003.php.expectf @@ -0,0 +1,10 @@ +array(1) { + [0]=> + &array(1) { + [0]=> + *RECURSION* + } +} +HipHop Warning: %a +string(8) "[[null]]" +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/004.php b/hphp/test/zend/good/ext-json/004.php new file mode 100644 index 000000000..8b575dcfc --- /dev/null +++ b/hphp/test/zend/good/ext-json/004.php @@ -0,0 +1,10 @@ +prop = $a; + +var_dump($a); +var_dump(json_encode($a)); + +echo "Done\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/004.php.expectf b/hphp/test/zend/good/ext-json/004.php.expectf new file mode 100644 index 000000000..afe90e01f --- /dev/null +++ b/hphp/test/zend/good/ext-json/004.php.expectf @@ -0,0 +1,7 @@ +object(stdClass)#%d (1) { + ["prop"]=> + *RECURSION* +} +HipHop Warning: %a +string(22) "{"prop":{"prop":null}}" +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/005.php b/hphp/test/zend/good/ext-json/005.php new file mode 100644 index 000000000..37fd1cef8 --- /dev/null +++ b/hphp/test/zend/good/ext-json/005.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/005.php.expectf b/hphp/test/zend/good/ext-json/005.php.expectf new file mode 100644 index 000000000..600cdb555 --- /dev/null +++ b/hphp/test/zend/good/ext-json/005.php.expectf @@ -0,0 +1,7 @@ +array(1) { + [0]=> + array(0) { + } +} +string(4) "[[]]" +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/006.php b/hphp/test/zend/good/ext-json/006.php new file mode 100644 index 000000000..182127691 --- /dev/null +++ b/hphp/test/zend/good/ext-json/006.php @@ -0,0 +1,11 @@ +',"'bar'",'"baz"','&blong&'); + +echo "Normal: ", json_encode($a), "\n"; +echo "Tags: ", json_encode($a,JSON_HEX_TAG), "\n"; +echo "Apos: ", json_encode($a,JSON_HEX_APOS), "\n"; +echo "Quot: ", json_encode($a,JSON_HEX_QUOT), "\n"; +echo "Amp: ", json_encode($a,JSON_HEX_AMP), "\n"; +echo "All: ", json_encode($a,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/006.php.expectf b/hphp/test/zend/good/ext-json/006.php.expectf new file mode 100644 index 000000000..36ffbf31d --- /dev/null +++ b/hphp/test/zend/good/ext-json/006.php.expectf @@ -0,0 +1,6 @@ +Normal: ["","'bar'","\"baz\"","&blong&"] +Tags: ["\u003Cfoo\u003E","'bar'","\"baz\"","&blong&"] +Apos: ["","\u0027bar\u0027","\"baz\"","&blong&"] +Quot: ["","'bar'","\u0022baz\u0022","&blong&"] +Amp: ["","'bar'","\"baz\"","\u0026blong\u0026"] +All: ["\u003Cfoo\u003E","\u0027bar\u0027","\u0022baz\u0022","\u0026blong\u0026"] \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug41034.php b/hphp/test/zend/good/ext-json/bug41034.php new file mode 100644 index 000000000..8b17b0564 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug41034.php @@ -0,0 +1,4 @@ +1,"\0null-prefixed value")); +echo "\nDone\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug41034.php.expectf b/hphp/test/zend/good/ext-json/bug41034.php.expectf new file mode 100644 index 000000000..319b7c836 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug41034.php.expectf @@ -0,0 +1,2 @@ +{"0":0,"\u0000ab":1,"1":"\u0000null-prefixed value"} +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug41067.php b/hphp/test/zend/good/ext-json/bug41067.php new file mode 100644 index 000000000..5eaa9ec97 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug41067.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug41067.php.expectf b/hphp/test/zend/good/ext-json/bug41067.php.expectf new file mode 100644 index 000000000..d20f7d152 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug41067.php.expectf @@ -0,0 +1,5 @@ +f09d8480 +["\ud834\udd00"] + +f09d8480 +END \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug41504.php b/hphp/test/zend/good/ext-json/bug41504.php new file mode 100644 index 000000000..a3adc14fe --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug41504.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug41504.php.expectf b/hphp/test/zend/good/ext-json/bug41504.php.expectf new file mode 100644 index 000000000..6441042b8 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug41504.php.expectf @@ -0,0 +1,17 @@ +array(1) { + [""]=> + string(5) "value" +} +array(2) { + [""]=> + string(5) "value" + ["key"]=> + string(5) "value" +} +array(2) { + ["key"]=> + string(5) "value" + [""]=> + string(5) "value" +} +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug42785.php b/hphp/test/zend/good/ext-json/bug42785.php new file mode 100644 index 000000000..1eed779bc --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug42785.php @@ -0,0 +1,12 @@ +a = 100.10; +$bar1->b = "foo"; +var_dump(json_encode($bar1)); +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug42785.php.expectf b/hphp/test/zend/good/ext-json/bug42785.php.expectf new file mode 100644 index 000000000..083133717 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug42785.php.expectf @@ -0,0 +1,2 @@ +string(13) "[100.1,"bar"]" +string(21) "{"a":100.1,"b":"foo"}" \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug43941.php b/hphp/test/zend/good/ext-json/bug43941.php new file mode 100644 index 000000000..32c38109a --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug43941.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug43941.php.expectf b/hphp/test/zend/good/ext-json/bug43941.php.expectf new file mode 100644 index 000000000..892d710f6 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug43941.php.expectf @@ -0,0 +1,5 @@ +string(5) ""abc"" +string(4) "null" +string(4) "null" +string(17) "[null,null,"abc"]" +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug46215.php b/hphp/test/zend/good/ext-json/bug46215.php new file mode 100644 index 000000000..5918a2ce7 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug46215.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug46215.php.expectf b/hphp/test/zend/good/ext-json/bug46215.php.expectf new file mode 100644 index 000000000..010468140 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug46215.php.expectf @@ -0,0 +1,7 @@ +foo Object +( + [a:protected] => Array + ( + ) + +) \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug46944.php b/hphp/test/zend/good/ext-json/bug46944.php new file mode 100644 index 000000000..626860098 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug46944.php @@ -0,0 +1,12 @@ +> 2); + $second = 0x8f|($i & 3) << 4; + $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second); + echo json_encode($string) . "\n"; +} + + +echo "Done\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug46944.php.expectf b/hphp/test/zend/good/ext-json/bug46944.php.expectf new file mode 100644 index 000000000..77104a7a6 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug46944.php.expectf @@ -0,0 +1,17 @@ +"aa\ud83f\udffdzz" +"aa\ud87f\udffdzz" +"aa\ud8bf\udffdzz" +"aa\ud8ff\udffdzz" +"aa\ud93f\udffdzz" +"aa\ud97f\udffdzz" +"aa\ud9bf\udffdzz" +"aa\ud9ff\udffdzz" +"aa\uda3f\udffdzz" +"aa\uda7f\udffdzz" +"aa\udabf\udffdzz" +"aa\udaff\udffdzz" +"aa\udb3f\udffdzz" +"aa\udb7f\udffdzz" +"aa\udbbf\udffdzz" +"aa\udbff\udffdzz" +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug47644.php b/hphp/test/zend/good/ext-json/bug47644.php new file mode 100644 index 000000000..45d0c761f --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug47644.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/bug47644.php.expectf b/hphp/test/zend/good/ext-json/bug47644.php.expectf new file mode 100644 index 000000000..b6cc4cfa3 --- /dev/null +++ b/hphp/test/zend/good/ext-json/bug47644.php.expectf @@ -0,0 +1,25 @@ +array(1) { + [0]=> + int(10000000000000000) +} +array(1) { + [0]=> + int(10000000000000001) +} +array(1) { + [0]=> + int(10000000000000002) +} +array(1) { + [0]=> + int(10000000000000003) +} +array(1) { + [0]=> + int(10000000000000004) +} +array(1) { + [0]=> + int(10000000000000005) +} +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/fail001.php b/hphp/test/zend/good/ext-json/fail001.php new file mode 100644 index 000000000..347916d0b --- /dev/null +++ b/hphp/test/zend/good/ext-json/fail001.php @@ -0,0 +1,37 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/fail001.php.expectf b/hphp/test/zend/good/ext-json/fail001.php.expectf new file mode 100644 index 000000000..2d820bc45 --- /dev/null +++ b/hphp/test/zend/good/ext-json/fail001.php.expectf @@ -0,0 +1,120 @@ +Testing: "A JSON payload should be an object or array, not a string." +AS OBJECT +string(58) "A JSON payload should be an object or array, not a string." +AS ARRAY +string(58) "A JSON payload should be an object or array, not a string." +Testing: ["Unclosed array" +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {unquoted_key: "keys must be quoted} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["extra comma",] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["double extra comma",,] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: [ , "<-- missing value"] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Comma after the close"], +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Extra close"]] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Extra comma": true,} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Extra value after close": true} "misplaced quoted value" +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Illegal expression": 1 + 2} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Illegal invocation": alert()} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Numbers cannot have leading zeroes": 013} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Numbers cannot be hex": 0x14} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Illegal backslash escape: \x15"] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Illegal backslash escape: \'"] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Illegal backslash escape: \017"] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Missing colon" null} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Double colon":: null} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: {"Comma instead of colon", null} +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Colon instead of comma": false] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ["Bad value", truth] +AS OBJECT +NULL +AS ARRAY +NULL +Testing: ['single quote'] +AS OBJECT +NULL +AS ARRAY +NULL \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_decode_error.php b/hphp/test/zend/good/ext-json/json_decode_error.php new file mode 100644 index 000000000..2b51f81a3 --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_decode_error.php @@ -0,0 +1,17 @@ + +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_decode_error.php.expectf b/hphp/test/zend/good/ext-json/json_decode_error.php.expectf new file mode 100644 index 000000000..282fd80c3 --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_decode_error.php.expectf @@ -0,0 +1,10 @@ +*** Testing json_decode() : error conditions *** + +-- Testing json_decode() function with no arguments -- +HipHop Warning: %a +NULL + +-- Testing json_decode() function with more than expected no. of arguments -- +HipHop Warning: %a +NULL +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_basic_utf8.php b/hphp/test/zend/good/ext-json/json_encode_basic_utf8.php new file mode 100644 index 000000000..e868851e6 --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_basic_utf8.php @@ -0,0 +1,13 @@ + +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_basic_utf8.php.expectf b/hphp/test/zend/good/ext-json/json_encode_basic_utf8.php.expectf new file mode 100644 index 000000000..177fc7b8c --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_basic_utf8.php.expectf @@ -0,0 +1,3 @@ +*** Testing json_encode() : basic functionality with UTF-8 input*** +string(103) ""\u65e5\u672c\u8a9e\u30c6\u30ad\u30b9\u30c8\u3067\u3059\u300201234\uff15\uff16\uff17\uff18\uff19\u3002"" +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_error.php b/hphp/test/zend/good/ext-json/json_encode_error.php new file mode 100644 index 000000000..761e97cba --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_error.php @@ -0,0 +1,18 @@ + +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_error.php.expectf b/hphp/test/zend/good/ext-json/json_encode_error.php.expectf new file mode 100644 index 000000000..e310b4635 --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_error.php.expectf @@ -0,0 +1,10 @@ +*** Testing json_encode() : error conditions *** + +-- Testing json_encode() function with no arguments -- +HipHop Warning: %a +NULL + +-- Testing json_encode() function with more than expected no. of arguments -- +HipHop Warning: %a +NULL +===Done=== \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_numeric.php b/hphp/test/zend/good/ext-json/json_encode_numeric.php new file mode 100644 index 000000000..d174bca8d --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_numeric.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_numeric.php.expectf b/hphp/test/zend/good/ext-json/json_encode_numeric.php.expectf new file mode 100644 index 000000000..167b1c0dc --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_numeric.php.expectf @@ -0,0 +1,6 @@ +string(1) "1" +string(6) "9.4324" +string(22) "[122321,3232595.33423]" +string(3) ""1"" +string(8) ""9.4324"" +string(26) "["122321","3232595.33423"]" \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_pretty_print.php b/hphp/test/zend/good/ext-json/json_encode_pretty_print.php new file mode 100644 index 000000000..097ed90d7 --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_pretty_print.php @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_pretty_print.php.expectf b/hphp/test/zend/good/ext-json/json_encode_pretty_print.php.expectf new file mode 100644 index 000000000..5378959bf --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_pretty_print.php.expectf @@ -0,0 +1,22 @@ +[ + 1, + 2, + 3, + [ + 1, + 2, + 3 + ] +] +Match: 1 +{ + "a": 1, + "b": [ + 1, + 2 + ], + "c": { + "d": 42 + } +} +Match: 1 \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_unescaped_slashes.php b/hphp/test/zend/good/ext-json/json_encode_unescaped_slashes.php new file mode 100644 index 000000000..ec594c62b --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_unescaped_slashes.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/json_encode_unescaped_slashes.php.expectf b/hphp/test/zend/good/ext-json/json_encode_unescaped_slashes.php.expectf new file mode 100644 index 000000000..25b026169 --- /dev/null +++ b/hphp/test/zend/good/ext-json/json_encode_unescaped_slashes.php.expectf @@ -0,0 +1,2 @@ +string(6) ""a\/b"" +string(5) ""a/b"" \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/pass002.php b/hphp/test/zend/good/ext-json/pass002.php new file mode 100644 index 000000000..1ca214dab --- /dev/null +++ b/hphp/test/zend/good/ext-json/pass002.php @@ -0,0 +1,26 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/pass002.php.expectf b/hphp/test/zend/good/ext-json/pass002.php.expectf new file mode 100644 index 000000000..c1777e783 --- /dev/null +++ b/hphp/test/zend/good/ext-json/pass002.php.expectf @@ -0,0 +1,241 @@ +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]=> + string(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]=> + string(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]=> + string(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]=> + string(12) "Not too deep" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/pass003.php b/hphp/test/zend/good/ext-json/pass003.php new file mode 100644 index 000000000..1e69cbd13 --- /dev/null +++ b/hphp/test/zend/good/ext-json/pass003.php @@ -0,0 +1,34 @@ + \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/pass003.php.expectf b/hphp/test/zend/good/ext-json/pass003.php.expectf new file mode 100644 index 000000000..703962223 --- /dev/null +++ b/hphp/test/zend/good/ext-json/pass003.php.expectf @@ -0,0 +1,52 @@ +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)#1 (1) { + ["JSON Test Pattern pass3"]=> + object(stdClass)#2 (2) { + ["The outermost value"]=> + string(27) "must be an object or array." + ["In this test"]=> + string(16) "It is an object." + } +} +DECODE: AS ARRAY +array(1) { + ["JSON Test Pattern pass3"]=> + array(2) { + ["The outermost value"]=> + string(27) "must be an object or array." + ["In this test"]=> + string(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)#3 (1) { + ["JSON Test Pattern pass3"]=> + object(stdClass)#4 (2) { + ["The outermost value"]=> + string(27) "must be an object or array." + ["In this test"]=> + string(16) "It is an object." + } +} +DECODE AGAIN: AS ARRAY +array(1) { + ["JSON Test Pattern pass3"]=> + array(2) { + ["The outermost value"]=> + string(27) "must be an object or array." + ["In this test"]=> + string(16) "It is an object." + } +} \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/serialize.php b/hphp/test/zend/good/ext-json/serialize.php new file mode 100644 index 000000000..00f04903b --- /dev/null +++ b/hphp/test/zend/good/ext-json/serialize.php @@ -0,0 +1,56 @@ +data = $data; + } +} + +class SerializingTest extends NonSerializingTest implements JsonSerializable +{ + public function jsonSerialize() + { + return $this->data; + } +} + +class ValueSerializingTest extends SerializingTest +{ + public function jsonSerialize() + { + return array_values(is_array($this->data) ? $this->data : get_object_vars($this->data)); + } +} + +class SelfSerializingTest extends SerializingTest +{ + public function jsonSerialize() + { + return $this; + } +} + +$adata = array( + 'str' => 'foo', + 'int' => 1, + 'float' => 2.3, + 'bool' => false, + 'nil' => null, + 'arr' => array(1,2,3), + 'obj' => new StdClass, +); + +$ndata = array_values($adata); + +$odata = (object)$adata; + +foreach(array('NonSerializingTest','SerializingTest','ValueSerializingTest','SelfSerializingTest') as $class) { + echo "==$class==\n"; + echo json_encode(new $class($adata)), "\n"; + echo json_encode(new $class($ndata)), "\n"; + echo json_encode(new $class($odata)), "\n"; +} \ No newline at end of file diff --git a/hphp/test/zend/good/ext-json/serialize.php.expectf b/hphp/test/zend/good/ext-json/serialize.php.expectf new file mode 100644 index 000000000..d4f44bcf1 --- /dev/null +++ b/hphp/test/zend/good/ext-json/serialize.php.expectf @@ -0,0 +1,16 @@ +==NonSerializingTest== +{"data":{"str":"foo","int":1,"float":2.3,"bool":false,"nil":null,"arr":[1,2,3],"obj":{}}} +{"data":["foo",1,2.3,false,null,[1,2,3],{}]} +{"data":{"str":"foo","int":1,"float":2.3,"bool":false,"nil":null,"arr":[1,2,3],"obj":{}}} +==SerializingTest== +{"str":"foo","int":1,"float":2.3,"bool":false,"nil":null,"arr":[1,2,3],"obj":{}} +["foo",1,2.3,false,null,[1,2,3],{}] +{"str":"foo","int":1,"float":2.3,"bool":false,"nil":null,"arr":[1,2,3],"obj":{}} +==ValueSerializingTest== +["foo",1,2.3,false,null,[1,2,3],{}] +["foo",1,2.3,false,null,[1,2,3],{}] +["foo",1,2.3,false,null,[1,2,3],{}] +==SelfSerializingTest== +{"data":{"str":"foo","int":1,"float":2.3,"bool":false,"nil":null,"arr":[1,2,3],"obj":{}}} +{"data":["foo",1,2.3,false,null,[1,2,3],{}]} +{"data":{"str":"foo","int":1,"float":2.3,"bool":false,"nil":null,"arr":[1,2,3],"obj":{}}} \ No newline at end of file diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py index de26df034..0ff8669ee 100755 --- a/hphp/tools/import_zend_test.py +++ b/hphp/tools/import_zend_test.py @@ -105,7 +105,6 @@ no_import = ( '/ext/gd', '/ext/imap', '/ext/intl', - '/ext/json', '/ext/ldap', '/ext/libxml', '/ext/mbstring',