summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Zelenka <bukka@php.net>2015-11-15 19:06:09 +0000
committerJakub Zelenka <bukka@php.net>2015-11-15 19:06:09 +0000
commite5abc53701ba5a9b58dfaba3b59881c9c410a8e7 (patch)
treecd52561b00721a80f3af32a3db28a716c5398175
parentf8bf9bd86bdeef33a48e43d772d8a25a4fe3e6ff (diff)
downloadphp-git-e5abc53701ba5a9b58dfaba3b59881c9c410a8e7.tar.gz
Use the same CS for all json tests
-rw-r--r--ext/json/tests/002.phpt1
-rw-r--r--ext/json/tests/006.phpt13
-rw-r--r--ext/json/tests/007.phpt1
-rw-r--r--ext/json/tests/bug40503.phpt8
-rw-r--r--ext/json/tests/bug41034.phpt2
-rw-r--r--ext/json/tests/bug41403.phpt2
-rw-r--r--ext/json/tests/bug42785.phpt13
-rw-r--r--ext/json/tests/bug46215.phpt8
-rw-r--r--ext/json/tests/bug46944.phpt4
-rw-r--r--ext/json/tests/bug47644.phpt4
-rw-r--r--ext/json/tests/bug54058.phpt4
-rw-r--r--ext/json/tests/bug54484.phpt2
-rw-r--r--ext/json/tests/bug61978.phpt32
-rw-r--r--ext/json/tests/bug62369.phpt28
-rw-r--r--ext/json/tests/bug63737.phpt8
-rw-r--r--ext/json/tests/bug64874_part1.phpt6
-rw-r--r--ext/json/tests/bug64874_part2.phpt4
-rw-r--r--ext/json/tests/bug66021.phpt2
-rw-r--r--ext/json/tests/fail001.phpt65
-rw-r--r--ext/json/tests/json_decode_basic.phpt57
-rw-r--r--ext/json/tests/json_decode_error.phpt15
-rw-r--r--ext/json/tests/json_encode_basic.phpt98
-rw-r--r--ext/json/tests/json_encode_basic_utf8.phpt11
-rw-r--r--ext/json/tests/json_encode_error.phpt16
-rw-r--r--ext/json/tests/json_encode_numeric.phpt6
-rw-r--r--ext/json/tests/json_last_error_error.phpt5
-rw-r--r--ext/json/tests/json_last_error_msg_error.phpt4
-rw-r--r--ext/json/tests/pass001.1.phpt4
-rw-r--r--ext/json/tests/pass001.1_64bit.phpt4
-rw-r--r--ext/json/tests/pass001.phpt2
-rw-r--r--ext/json/tests/pass002.phpt4
-rw-r--r--ext/json/tests/pass003.phpt4
32 files changed, 185 insertions, 252 deletions
diff --git a/ext/json/tests/002.phpt b/ext/json/tests/002.phpt
index 5959d4a5f3..b562b616c8 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 e1d4b46889..da2fe009f1 100644
--- a/ext/json/tests/006.phpt
+++ b/ext/json/tests/006.phpt
@@ -4,15 +4,14 @@ json_encode() & extended encoding
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-
-$a = array('<foo>',"'bar'",'"baz"','&blong&');
+$a = array('<foo>', "'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: ["<foo>","'bar'","\"baz\"","&blong&"]
diff --git a/ext/json/tests/007.phpt b/ext/json/tests/007.phpt
index 7557ac9ed7..008d1dd5de 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 48f18a4e0f..387ba299ec 100644
--- a/ext/json/tests/bug40503.phpt
+++ b/ext/json/tests/bug40503.phpt
@@ -6,14 +6,14 @@ precision=14
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-function show_eq($x,$y) {
- echo "$x ". ($x==$y ? "==" : "!=") ." $y\n";
+function json_test_show_eq($x, $y) {
+ echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
}
$value = 0x7FFFFFFF; #2147483647;
-show_eq("$value", json_encode($value));
+json_test_show_eq("$value", json_encode($value));
$value++;
-show_eq("$value", json_encode($value));
+json_test_show_eq("$value", json_encode($value));
?>
--EXPECT--
diff --git a/ext/json/tests/bug41034.phpt b/ext/json/tests/bug41034.phpt
index cc7704122d..58ae281e6c 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)
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-echo json_encode(array(0,"\0ab"=>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 1a7343122a..f0e5f3b511 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--
<?php
-
if (!extension_loaded('json')) die('skip');
-
if (setlocale(LC_NUMERIC, "de_DE") === false) {
die("skip no de_DE locale");
}
diff --git a/ext/json/tests/bug42785.phpt b/ext/json/tests/bug42785.phpt
index 7bdadbed1e..c4cda1196e 100644
--- a/ext/json/tests/bug42785.phpt
+++ b/ext/json/tests/bug42785.phpt
@@ -2,20 +2,19 @@
Bug #42785 (Incorrect formatting of double values with non-english locales)
--SKIPIF--
<?php
- if (!extension_loaded("json")) {
- print "skip";
- } else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
- die("skip locale needed for this test is not supported on this platform");
- }
+if (!extension_loaded('json')) die('skip');
+if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
+ die("skip locale needed for this test is not supported on this platform");
+}
?>
--FILE--
<?php
setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
-$foo = Array(100.10,"bar");
+$foo = array(100.10,"bar");
var_dump(json_encode($foo));
-Class bar {}
+class bar {}
$bar1 = new bar;
$bar1->a = 100.10;
$bar1->b = "foo";
diff --git a/ext/json/tests/bug46215.phpt b/ext/json/tests/bug46215.phpt
index 0ac460cc15..be3a80f860 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--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
class foo {
- protected $a = array();
+ protected $a = array();
}
$a = new foo;
diff --git a/ext/json/tests/bug46944.phpt b/ext/json/tests/bug46944.phpt
index 812a548875..3d70f3ee11 100644
--- a/ext/json/tests/bug46944.phpt
+++ b/ext/json/tests/bug46944.phpt
@@ -6,8 +6,8 @@ Bug #46944 (json_encode() doesn't handle 3 byte utf8 correctly)
<?php
for ($i = 1; $i <= 16; $i++) {
- $first = 0xf0|($i >> 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 5e996b6973..85c4858af5 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--
<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
- if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+if (!extension_loaded('json')) die('skip');
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
diff --git a/ext/json/tests/bug54058.phpt b/ext/json/tests/bug54058.phpt
index df1b3130f8..4b8773f93d 100644
--- a/ext/json/tests/bug54058.phpt
+++ b/ext/json/tests/bug54058.phpt
@@ -22,8 +22,8 @@ json_encode($b);
var_dump(json_last_error(), json_last_error_msg());
$c = array(
- 'foo' => $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 d698ab5416..3a38475019 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 c34b03f8f7..56b92dc672 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
<?php
class JsonTest1 {
- public $test;
- public $me;
- public function __construct() {
- $this->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 a5efd802c5..cf254bfc18 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)
<?php
$array = array();
-for ($i=0; $i<550; $i++) {
- $array = array($array);
+for ($i=0; $i < 550; $i++) {
+ $array = array($array);
}
json_encode($array, 0, 551);
switch (json_last_error()) {
- case JSON_ERROR_NONE:
- echo 'OK'.PHP_EOL;
- break;
- case JSON_ERROR_DEPTH:
- echo 'ERROR'.PHP_EOL;
- break;
+ case JSON_ERROR_NONE:
+ echo 'OK' . PHP_EOL;
+ break;
+ case JSON_ERROR_DEPTH:
+ echo 'ERROR' . PHP_EOL;
+ break;
}
json_encode($array, 0, 540);
switch (json_last_error()) {
- case JSON_ERROR_NONE:
- echo 'OK'.PHP_EOL;
- break;
- case JSON_ERROR_DEPTH:
- echo 'ERROR'.PHP_EOL;
- break;
+ case JSON_ERROR_NONE:
+ echo 'OK' . PHP_EOL;
+ break;
+ case JSON_ERROR_DEPTH:
+ echo 'ERROR' . PHP_EOL;
+ break;
}
--EXPECTF--
OK
diff --git a/ext/json/tests/bug63737.phpt b/ext/json/tests/bug63737.phpt
index 1fb06d485e..35361d850a 100644
--- a/ext/json/tests/bug63737.phpt
+++ b/ext/json/tests/bug63737.phpt
@@ -5,10 +5,10 @@ Bug #63737 (json_decode does not properly decode with options parameter)
--FILE--
<?php
function decode($json) {
- $x = json_decode($json);
- var_dump($x);
- $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
- var_dump($x);
+ $x = json_decode($json);
+ var_dump($x);
+ $x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
+ var_dump($x);
}
decode('123456789012345678901234567890');
diff --git a/ext/json/tests/bug64874_part1.phpt b/ext/json/tests/bug64874_part1.phpt
index 6b79b8dc04..9e0cb7e1cf 100644
--- a/ext/json/tests/bug64874_part1.phpt
+++ b/ext/json/tests/bug64874_part1.phpt
@@ -5,9 +5,9 @@ Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitiv
--FILE--
<?php
function decode($json) {
- var_dump(json_decode($json));
- var_dump(json_last_error() !== 0);
- echo "\n";
+ var_dump(json_decode($json));
+ var_dump(json_last_error() !== 0);
+ echo "\n";
}
// Leading whitespace should be ignored
diff --git a/ext/json/tests/bug64874_part2.phpt b/ext/json/tests/bug64874_part2.phpt
index 338fc1141a..db784bd8e0 100644
--- a/ext/json/tests/bug64874_part2.phpt
+++ b/ext/json/tests/bug64874_part2.phpt
@@ -5,8 +5,8 @@ Case-sensitivity part of bug #64874 ("json_decode handles whitespace and case-se
--FILE--
<?php
function decode($json) {
- var_dump(json_decode($json));
- echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
+ var_dump(json_decode($json));
+ echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
}
// Only lowercase should work
diff --git a/ext/json/tests/bug66021.phpt b/ext/json/tests/bug66021.phpt
index cf52e0c6df..504d17fc78 100644
--- a/ext/json/tests/bug66021.phpt
+++ b/ext/json/tests/bug66021.phpt
@@ -9,7 +9,7 @@ class Foo {
private $bar = 'baz';
}
-echo json_encode([[], (object)[], new Foo], JSON_PRETTY_PRINT), "\n";
+echo json_encode(array(array(), (object) array(), new Foo), JSON_PRETTY_PRINT);
?>
--EXPECT--
diff --git a/ext/json/tests/fail001.phpt b/ext/json/tests/fail001.phpt
index 1bf9f12106..ea203746a6 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--
<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
+ if (!extension_loaded('json')) die('skip');
?>
--FILE--
<?php
-$tests = array('"A JSON payload should be an object or array, not a string."',
- '["Unclosed array"',
- '{unquoted_key: "keys must be quoted}',
- '["extra comma",]',
- '["double extra comma",,]',
- '[ , "<-- missing value"]',
- '["Comma after the close"],',
- '["Extra close"]]',
- '{"Extra comma": true,}',
- '{"Extra value after close": true} "misplaced quoted value"',
- '{"Illegal expression": 1 + 2}',
- '{"Illegal invocation": alert()}',
- '{"Numbers cannot have leading zeroes": 013}',
- '{"Numbers cannot be hex": 0x14}',
- '["Illegal backslash escape: \\x15"]',
- '["Illegal backslash escape: \\\'"]',
- '["Illegal backslash escape: \\017"]',
- '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
- '{"Missing colon" null}',
- '{"Double colon":: null}',
- '{"Comma instead of colon", null}',
- '["Colon instead of comma": false]',
- '["Bad value", truth]',
- "['single quote']");
+$tests = array(
+ '"A JSON payload should be an object or array, not a string."',
+ '["Unclosed array"',
+ '{unquoted_key: "keys must be quoted}',
+ '["extra comma",]',
+ '["double extra comma",,]',
+ '[ , "<-- missing value"]',
+ '["Comma after the close"],',
+ '["Extra close"]]',
+ '{"Extra comma": true,}',
+ '{"Extra value after close": true} "misplaced quoted value"',
+ '{"Illegal expression": 1 + 2}',
+ '{"Illegal invocation": alert()}',
+ '{"Numbers cannot have leading zeroes": 013}',
+ '{"Numbers cannot be hex": 0x14}',
+ '["Illegal backslash escape: \\x15"]',
+ '["Illegal backslash escape: \\\'"]',
+ '["Illegal backslash escape: \\017"]',
+ '[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
+ '{"Missing colon" null}',
+ '{"Double colon":: null}',
+ '{"Comma instead of colon", null}',
+ '["Colon instead of comma": false]',
+ '["Bad value", truth]',
+ "['single quote']"
+);
-foreach ($tests as $test)
-{
- echo 'Testing: ' . $test . "\n";
- echo "AS OBJECT\n";
- var_dump(json_decode($test));
- echo "AS ARRAY\n";
- var_dump(json_decode($test, true));
+foreach ($tests as $test) {
+ echo 'Testing: ' . $test . "\n";
+ echo "AS OBJECT\n";
+ var_dump(json_decode($test));
+ echo "AS ARRAY\n";
+ var_dump(json_decode($test, true));
}
?>
diff --git a/ext/json/tests/json_decode_basic.phpt b/ext/json/tests/json_decode_basic.phpt
index 6dbeadb367..0bc939c257 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--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-/* Prototype : mixed json_decode ( string $json [, bool $assoc ] )
- * Description: Decodes a JSON string
- * Source code: ext/json/php_json.c
- * Alias to functions:
- */
echo "*** Testing json_decode() : basic functionality ***\n";
// array with different values for $string
$inputs = array (
- '0',
- '123',
- '-123',
- '2147483647',
- '-2147483648',
- '123.456',
- '1230',
- '-1230',
- 'true',
- 'false',
- 'null',
- '"abc"',
- '"Hello World\r\n"',
- '[]',
- '[1,2,3,4,5]',
- '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
- '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
- '""',
- '{}'
+ '0',
+ '123',
+ '-123',
+ '2147483647',
+ '-2147483648',
+ '123.456',
+ '1230',
+ '-1230',
+ 'true',
+ 'false',
+ 'null',
+ '"abc"',
+ '"Hello World\r\n"',
+ '[]',
+ '[1,2,3,4,5]',
+ '{"myInt":99,"myFloat":123.45,"myNull":null,"myBool":true,"myString":"Hello World"}',
+ '{"Jan":31,"Feb":29,"Mar":31,"April":30,"May":31,"June":30}',
+ '""',
+ '{}'
);
// loop through with each element of the $inputs array to test json_decode() function
$count = 1;
foreach($inputs as $input) {
- echo "-- Iteration $count --\n";
- var_dump(json_decode($input));
- var_dump(json_decode($input, TRUE));
- $count ++;
+ echo "-- Iteration $count --\n";
+ var_dump(json_decode($input));
+ var_dump(json_decode($input, true));
+ $count++;
}
?>
diff --git a/ext/json/tests/json_decode_error.phpt b/ext/json/tests/json_decode_error.phpt
index 4d5d4e4bee..90a42889a0 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--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-/* Prototype : mixed json_decode ( string $json [, bool $assoc=false [, int $depth=512 ]] )
- * Description: Decodes a JSON string
- * Source code: ext/json/php_json.c
- * Alias to functions:
- */
echo "*** Testing json_decode() : error conditions ***\n";
echo "\n-- Testing json_decode() function with no arguments --\n";
-var_dump( json_decode() );
+var_dump(json_decode());
echo "\n-- Testing json_decode() function with more than expected no. of arguments --\n";
$extra_arg = 10;
-var_dump( json_decode('"abc"', TRUE, 512, 0, $extra_arg) );
+var_dump(json_decode('"abc"', true, 512, 0, $extra_arg));
?>
===Done===
diff --git a/ext/json/tests/json_encode_basic.phpt b/ext/json/tests/json_encode_basic.phpt
index fc348eed81..7fe855d1dc 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--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-/* Prototype : string json_encode ( mixed $value )
- * Description: Returns the JSON representation of a value
- * Source code: ext/json/php_json.c
- * Alias to functions:
- */
echo "*** Testing json_encode() : basic functionality ***\n";
//get an unset variable
@@ -35,64 +26,63 @@ $obj->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
-/*9*/ TRUE,
- true,
- FALSE,
- false,
+ // boolean
+ TRUE,
+ true,
+ FALSE,
+ false,
- // NULL
-/*13*/ NULL,
- null,
-
- // strings
-/*15*/ "abc",
- 'abc',
- "Hello\t\tWorld\n",
+ // NULL
+ NULL,
+ null,
- // 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*/ "",
- '',
+ // strings
+ "abc",
+ 'abc',
+ "Hello\t\tWorld\n",
+
+ // 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),
+
+ // empty data
+ "",
+ '',
- // undefined data
-/*24*/ @$undefined_var,
+ // undefined data
+ @$undefined_var,
- // unset data
-/*25*/ @$unset_var,
+ // unset data
+ @$unset_var,
- // resource variable
-/*26*/ $fp,
+ // resource variable
+ $fp,
- // object variable
-/*27*/ $obj
+ // 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 a8e8b425ef..d03e83a8a9 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--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-/* Prototype : string json_encode ( mixed $value )
- * Description: Returns the JSON representation of a value
- * Source code: ext/json/php_json.c
- * Alias to functions:
- */
echo "*** Testing json_encode() : basic functionality with UTF-8 input***\n";
$utf8_string = base64_decode('5pel5pys6Kqe44OG44Kt44K544OI44Gn44GZ44CCMDEyMzTvvJXvvJbvvJfvvJjvvJnjgII=');
diff --git a/ext/json/tests/json_encode_error.phpt b/ext/json/tests/json_encode_error.phpt
index 547c8bef17..defc7b474c 100644
--- a/ext/json/tests/json_encode_error.phpt
+++ b/ext/json/tests/json_encode_error.phpt
@@ -1,27 +1,17 @@
--TEST--
Test json_encode() function : error conditions
--SKIPIF--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
-/* Prototype : string json_encode ( mixed $value [, int $options=0 ] )
- * Description: Returns the JSON representation of a value
- * Source code: ext/json/php_json.c
- * Alias to functions:
- */
-
echo "*** Testing json_encode() : error conditions ***\n";
echo "\n-- Testing json_encode() function with no arguments --\n";
-var_dump( json_encode() );
+var_dump(json_encode());
echo "\n-- Testing json_encode() function with more than expected no. of arguments --\n";
$extra_arg = 10;
-var_dump( json_encode("abc", 0, $extra_arg) );
+var_dump(json_encode("abc", 0, $extra_arg));
?>
===Done===
diff --git a/ext/json/tests/json_encode_numeric.phpt b/ext/json/tests/json_encode_numeric.phpt
index 5392350194..5850c4c959 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--
-<?php
-if (!extension_loaded("json")) {
- die('skip JSON extension not available in this build');
-}
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(
diff --git a/ext/json/tests/json_last_error_error.phpt b/ext/json/tests/json_last_error_error.phpt
index bb00388a2e..9b520ed9a7 100644
--- a/ext/json/tests/json_last_error_error.phpt
+++ b/ext/json/tests/json_last_error_error.phpt
@@ -1,15 +1,14 @@
--TEST--
json_last_error() failures
--SKIPIF--
-<?php !extension_loaded('json') && die('skip json extension not available') ?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(json_last_error());
-var_dump(json_last_error(TRUE));
+var_dump(json_last_error(true));
var_dump(json_last_error('some', 4, 'args', 'here'));
-
?>
--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 8135cf1ded..1a5f9d1bda 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--
-<?php !extension_loaded('json') && die('skip json extension not available') ?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(json_last_error_msg());
-var_dump(json_last_error_msg(TRUE));
+var_dump(json_last_error_msg(true));
var_dump(json_last_error_msg('some', 4, 'args', 'here'));
?>
diff --git a/ext/json/tests/pass001.1.phpt b/ext/json/tests/pass001.1.phpt
index a51f885780..611c40c4a4 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--
<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
- if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
+if (!extension_loaded('json')) die('skip');
+if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
?>
--FILE--
<?php
diff --git a/ext/json/tests/pass001.1_64bit.phpt b/ext/json/tests/pass001.1_64bit.phpt
index ff2714436d..e6666d1599 100644
--- a/ext/json/tests/pass001.1_64bit.phpt
+++ b/ext/json/tests/pass001.1_64bit.phpt
@@ -4,8 +4,8 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
precision=14
--SKIPIF--
<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
- if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
+if (!extension_loaded('json')) die('skip');
+if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
diff --git a/ext/json/tests/pass001.phpt b/ext/json/tests/pass001.phpt
index 1fd05fcdd8..ffe7c61f01 100644
--- a/ext/json/tests/pass001.phpt
+++ b/ext/json/tests/pass001.phpt
@@ -4,7 +4,7 @@ JSON (http://www.crockford.com/JSON/JSON_checker/test/pass1.json)
precision=14
--SKIPIF--
<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
+if (!extension_loaded('json')) die('skip');
?>
--FILE--
<?php
diff --git a/ext/json/tests/pass002.phpt b/ext/json/tests/pass002.phpt
index 24c7e33580..aa61cf5396 100644
--- a/ext/json/tests/pass002.phpt
+++ b/ext/json/tests/pass002.phpt
@@ -1,9 +1,7 @@
--TEST--
JSON (http://www.crockford.com/JSON/JSON_checker/test/pass2.json)
--SKIPIF--
-<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
diff --git a/ext/json/tests/pass003.phpt b/ext/json/tests/pass003.phpt
index 36da4a1de6..5e8c1664d0 100644
--- a/ext/json/tests/pass003.phpt
+++ b/ext/json/tests/pass003.phpt
@@ -1,9 +1,7 @@
--TEST--
JSON (http://www.crockford.com/JSON/JSON_checker/test/pass3.json)
--SKIPIF--
-<?php
- if (!extension_loaded('json')) die('skip: json extension not available');
-?>
+<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php