diff --git a/ext/json/tests/002.phpt b/ext/json/tests/002.phpt index 5959d4a5f39..b562b616c8e 100644 --- a/ext/json/tests/002.phpt +++ b/ext/json/tests/002.phpt @@ -20,7 +20,6 @@ var_dump(json_encode(array(), JSON_FORCE_OBJECT)); var_dump(json_encode(1)); var_dump(json_encode("руссиш")); - echo "Done\n"; ?> --EXPECTF-- diff --git a/ext/json/tests/006.phpt b/ext/json/tests/006.phpt index e1d4b468890..da2fe009f1f 100644 --- a/ext/json/tests/006.phpt +++ b/ext/json/tests/006.phpt @@ -4,15 +4,14 @@ json_encode() & extended encoding --FILE-- ',"'bar'",'"baz"','&blong&'); +$a = array('', "'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"; +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"; ?> --EXPECT-- Normal: ["","'bar'","\"baz\"","&blong&"] diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt index 7557ac9ed74..008d1dd5de4 100644 --- a/ext/json/tests/007.phpt +++ b/ext/json/tests/007.phpt @@ -15,7 +15,6 @@ var_dump(json_last_error(), json_last_error_msg()); var_dump(json_decode("[1")); var_dump(json_last_error(), json_last_error_msg()); - echo "Done\n"; ?> --EXPECT-- diff --git a/ext/json/tests/bug40503.phpt b/ext/json/tests/bug40503.phpt index 48f18a4e0f5..387ba299ecd 100644 --- a/ext/json/tests/bug40503.phpt +++ b/ext/json/tests/bug40503.phpt @@ -6,14 +6,14 @@ precision=14 --FILE-- --EXPECT-- diff --git a/ext/json/tests/bug41034.phpt b/ext/json/tests/bug41034.phpt index cc7704122d7..58ae281e6c4 100644 --- a/ext/json/tests/bug41034.phpt +++ b/ext/json/tests/bug41034.phpt @@ -4,7 +4,7 @@ Bug #41034 (json_encode() ignores null byte started keys in arrays) --FILE-- 1,"\0null-prefixed value")); +echo json_encode(array(0, "\0ab"=>1, "\0null-prefixed value")); echo "\nDone\n"; ?> --EXPECT-- diff --git a/ext/json/tests/bug41403.phpt b/ext/json/tests/bug41403.phpt index 1a7343122a1..f0e5f3b511a 100644 --- a/ext/json/tests/bug41403.phpt +++ b/ext/json/tests/bug41403.phpt @@ -2,9 +2,7 @@ Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.') --SKIPIF-- --FILE-- a = 100.10; $bar1->b = "foo"; diff --git a/ext/json/tests/bug46215.phpt b/ext/json/tests/bug46215.phpt index 0ac460cc15f..be3a80f8600 100644 --- a/ext/json/tests/bug46215.phpt +++ b/ext/json/tests/bug46215.phpt @@ -1,16 +1,12 @@ --TEST-- Bug #46215 (json_encode mutates its parameter and has some class-specific state) --SKIPIF-- - + --FILE-- > 2); - $second = 0x8f|($i & 3) << 4; + $first = 0xf0 | ($i >> 2); + $second = 0x8f | ($i & 3) << 4; $string = sprintf("aa%c%c\xbf\xbdzz", $first, $second); echo json_encode($string) . "\n"; } diff --git a/ext/json/tests/bug47644.phpt b/ext/json/tests/bug47644.phpt index 5e996b69730..85c4858af54 100644 --- a/ext/json/tests/bug47644.phpt +++ b/ext/json/tests/bug47644.phpt @@ -2,8 +2,8 @@ Bug #47644 (valid large integers are truncated) --SKIPIF-- --FILE-- $bad_utf8, - 'bar' => 1 + 'foo' => $bad_utf8, + 'bar' => 1 ); json_encode($c); var_dump(json_last_error(), json_last_error_msg()); diff --git a/ext/json/tests/bug54484.phpt b/ext/json/tests/bug54484.phpt index d698ab54164..3a384750199 100644 --- a/ext/json/tests/bug54484.phpt +++ b/ext/json/tests/bug54484.phpt @@ -10,11 +10,9 @@ var_dump(json_last_error()); json_decode(""); var_dump(json_last_error()); - json_decode("invalid json"); var_dump(json_last_error()); - json_decode(""); var_dump(json_last_error()); ?> diff --git a/ext/json/tests/bug61978.phpt b/ext/json/tests/bug61978.phpt index c34b03f8f73..56b92dc6726 100644 --- a/ext/json/tests/bug61978.phpt +++ b/ext/json/tests/bug61978.phpt @@ -6,25 +6,25 @@ Bug #61978 (Object recursion not detected for classes that implement JsonSeriali test = '123'; - $this->me = $this; - } + public $test; + public $me; + public function __construct() { + $this->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 - ); - } + public $test; + public function __construct() { + $this->test = '123'; + } + public function jsonSerialize() { + return array( + 'test' => $this->test, + 'me' => $this + ); + } } diff --git a/ext/json/tests/bug62369.phpt b/ext/json/tests/bug62369.phpt index a5efd802c5e..cf254bfc18b 100644 --- a/ext/json/tests/bug62369.phpt +++ b/ext/json/tests/bug62369.phpt @@ -6,28 +6,28 @@ FR #62369 (Segfault on json_encode(deeply_nested_array) --EXPECT-- diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt index 1bf9f121067..ea203746a6d 100644 --- a/ext/json/tests/fail001.phpt +++ b/ext/json/tests/fail001.phpt @@ -2,43 +2,44 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json) --SKIPIF-- --FILE-- diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt index 6dbeadb3675..0bc939c2573 100644 --- a/ext/json/tests/json_decode_basic.phpt +++ b/ext/json/tests/json_decode_basic.phpt @@ -1,50 +1,41 @@ --TEST-- Test json_decode() function : basic functionality --SKIPIF-- - + --FILE-- diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt index 4d5d4e4bee7..90a42889a03 100644 --- a/ext/json/tests/json_decode_error.phpt +++ b/ext/json/tests/json_decode_error.phpt @@ -1,26 +1,17 @@ --TEST-- Test json_decode() function : error conditions --SKIPIF-- - + --FILE-- ===Done=== diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt index fc348eed811..7fe855d1dc9 100644 --- a/ext/json/tests/json_encode_basic.phpt +++ b/ext/json/tests/json_encode_basic.phpt @@ -1,18 +1,9 @@ --TEST-- Test json_encode() function : basic functionality --SKIPIF-- - + --FILE-- MyString = "Hello World"; // array with different values for $string $inputs = array ( + // integers + 0, + 123, + -123, + 2147483647, + -2147483648, - // integers -/*1*/ 0, - 123, - -123, - 2147483647, - -2147483648, + // floats + 123.456, + 1.23E3, + -1.23E3, - // floats -/*6*/ 123.456, - 1.23E3, - -1.23E3, + // boolean + TRUE, + true, + FALSE, + false, + + // NULL + NULL, + null, - // boolean -/*9*/ TRUE, - true, - FALSE, - false, + // strings + "abc", + 'abc', + "Hello\t\tWorld\n", - // 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*/ "", - '', + // arrays + 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), - // undefined data -/*24*/ @$undefined_var, + // empty data + "", + '', - // unset data -/*25*/ @$unset_var, + // undefined data + @$undefined_var, - // resource variable -/*26*/ $fp, + // unset data + @$unset_var, - // object variable -/*27*/ $obj + // resource variable + $fp, + + // object variable + $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 ++; + echo "-- Iteration $count --\n"; + var_dump(json_encode($input)); + $count ++; } ?> diff --git a/ext/json/tests/json_encode_basic_utf8.phpt b/ext/json/tests/json_encode_basic_utf8.phpt index a8e8b425efb..d03e83a8a9e 100644 --- a/ext/json/tests/json_encode_basic_utf8.phpt +++ b/ext/json/tests/json_encode_basic_utf8.phpt @@ -1,18 +1,9 @@ --TEST-- Test json_encode() function : basic functionality with UTF8 string input --SKIPIF-- - + --FILE-- + --FILE-- ===Done=== diff --git a/ext/json/tests/json_encode_numeric.phpt b/ext/json/tests/json_encode_numeric.phpt index 5392350194f..5850c4c9596 100644 --- a/ext/json/tests/json_encode_numeric.phpt +++ b/ext/json/tests/json_encode_numeric.phpt @@ -1,11 +1,7 @@ --TEST-- Test json_encode() function with numeric flag --SKIPIF-- - + --FILE-- + --FILE-- --EXPECTF-- int(0) diff --git a/ext/json/tests/json_last_error_msg_error.phpt b/ext/json/tests/json_last_error_msg_error.phpt index 8135cf1dede..1a5f9d1bda8 100644 --- a/ext/json/tests/json_last_error_msg_error.phpt +++ b/ext/json/tests/json_last_error_msg_error.phpt @@ -1,12 +1,12 @@ --TEST-- json_last_error_msg() failures --SKIPIF-- - + --FILE-- diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt index a51f885780d..611c40c4a41 100644 --- a/ext/json/tests/pass001.1.phpt +++ b/ext/json/tests/pass001.1.phpt @@ -4,8 +4,8 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json) precision=14 --SKIPIF-- --FILE-- --FILE-- --FILE-- + --FILE-- + --FILE--