Skip to content

Commit 3c32019

Browse files
committed
Merge branch 'PHP-5.6' into PHP-7.0
2 parents 7819fef + e5abc53 commit 3c32019

32 files changed

+185
-253
lines changed

ext/json/tests/002.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ var_dump(json_encode(array(), JSON_FORCE_OBJECT));
2020
var_dump(json_encode(1));
2121
var_dump(json_encode("руссиш"));
2222

23-
2423
echo "Done\n";
2524
?>
2625
--EXPECTF--

ext/json/tests/006.phpt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ json_encode() & extended encoding
44
<?php if (!extension_loaded("json")) print "skip"; ?>
55
--FILE--
66
<?php
7-
8-
$a = array('<foo>',"'bar'",'"baz"','&blong&');
7+
$a = array('<foo>', "'bar'", '"baz"', '&blong&');
98

109
echo "Normal: ", json_encode($a), "\n";
11-
echo "Tags: ", json_encode($a,JSON_HEX_TAG), "\n";
12-
echo "Apos: ", json_encode($a,JSON_HEX_APOS), "\n";
13-
echo "Quot: ", json_encode($a,JSON_HEX_QUOT), "\n";
14-
echo "Amp: ", json_encode($a,JSON_HEX_AMP), "\n";
15-
echo "All: ", json_encode($a,JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n";
10+
echo "Tags: ", json_encode($a, JSON_HEX_TAG), "\n";
11+
echo "Apos: ", json_encode($a, JSON_HEX_APOS), "\n";
12+
echo "Quot: ", json_encode($a, JSON_HEX_QUOT), "\n";
13+
echo "Amp: ", json_encode($a, JSON_HEX_AMP), "\n";
14+
echo "All: ", json_encode($a, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_QUOT|JSON_HEX_AMP), "\n";
1615
?>
1716
--EXPECT--
1817
Normal: ["<foo>","'bar'","\"baz\"","&blong&"]

ext/json/tests/007.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ var_dump(json_last_error(), json_last_error_msg());
1515
var_dump(json_decode("[1"));
1616
var_dump(json_last_error(), json_last_error_msg());
1717

18-
1918
echo "Done\n";
2019
?>
2120
--EXPECT--

ext/json/tests/bug40503.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ precision=14
66
<?php if (!extension_loaded("json")) print "skip"; ?>
77
--FILE--
88
<?php
9-
function show_eq($x,$y) {
10-
echo "$x ". ($x==$y ? "==" : "!=") ." $y\n";
9+
function json_test_show_eq($x, $y) {
10+
echo "$x ". ( $x == $y ? "==" : "!=") ." $y\n";
1111
}
1212

1313
$value = 0x7FFFFFFF; #2147483647;
14-
show_eq("$value", json_encode($value));
14+
json_test_show_eq("$value", json_encode($value));
1515
$value++;
16-
show_eq("$value", json_encode($value));
16+
json_test_show_eq("$value", json_encode($value));
1717

1818
?>
1919
--EXPECT--

ext/json/tests/bug41034.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Bug #41034 (json_encode() ignores null byte started keys in arrays)
44
<?php if (!extension_loaded("json")) print "skip"; ?>
55
--FILE--
66
<?php
7-
echo json_encode(array(0,"\0ab"=>1,"\0null-prefixed value"));
7+
echo json_encode(array(0, "\0ab"=>1, "\0null-prefixed value"));
88
echo "\nDone\n";
99
?>
1010
--EXPECT--

ext/json/tests/bug41403.phpt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Bug #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
33
--SKIPIF--
44
<?php
5-
65
if (!extension_loaded('json')) die('skip');
7-
86
if (setlocale(LC_NUMERIC, "de_DE") === false) {
97
die("skip no de_DE locale");
108
}

ext/json/tests/bug42785.phpt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
Bug #42785 (Incorrect formatting of double values with non-english locales)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("json")) {
6-
print "skip";
7-
} else if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
8-
die("skip locale needed for this test is not supported on this platform");
9-
}
5+
if (!extension_loaded('json')) die('skip');
6+
if (!setlocale(LC_CTYPE, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1")) {
7+
die("skip locale needed for this test is not supported on this platform");
8+
}
109
?>
1110
--FILE--
1211
<?php
1312
setlocale(LC_ALL, "de_DE", "de", "german", "ge", "de_DE.ISO8859-1", "ISO8859-1");
1413

15-
$foo = Array(100.10,"bar");
14+
$foo = array(100.10,"bar");
1615
var_dump(json_encode($foo));
1716

18-
Class bar {}
17+
class bar {}
1918
$bar1 = new bar;
2019
$bar1->a = 100.10;
2120
$bar1->b = "foo";

ext/json/tests/bug46215.phpt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
--TEST--
22
Bug #46215 (json_encode mutates its parameter and has some class-specific state)
33
--SKIPIF--
4-
<?php
5-
if (!extension_loaded("json")) {
6-
die('skip JSON extension not available in this build');
7-
}
8-
?>
4+
<?php if (!extension_loaded("json")) print "skip"; ?>
95
--FILE--
106
<?php
117

128
class foo {
13-
protected $a = array();
9+
protected $a = array();
1410
}
1511

1612
$a = new foo;

ext/json/tests/bug46944.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Bug #46944 (json_encode() doesn't handle 3 byte utf8 correctly)
66
<?php
77

88
for ($i = 1; $i <= 16; $i++) {
9-
$first = 0xf0|($i >> 2);
10-
$second = 0x8f|($i & 3) << 4;
9+
$first = 0xf0 | ($i >> 2);
10+
$second = 0x8f | ($i & 3) << 4;
1111
$string = sprintf("aa%c%c\xbf\xbdzz", $first, $second);
1212
echo json_encode($string) . "\n";
1313
}

ext/json/tests/bug47644.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Bug #47644 (valid large integers are truncated)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded('json')) die('skip: json extension not available');
6-
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
5+
if (!extension_loaded('json')) die('skip');
6+
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
77
?>
88
--FILE--
99
<?php

ext/json/tests/bug54058.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ json_encode($b);
2222
var_dump(json_last_error(), json_last_error_msg());
2323

2424
$c = array(
25-
'foo' => $bad_utf8,
26-
'bar' => 1
25+
'foo' => $bad_utf8,
26+
'bar' => 1
2727
);
2828
json_encode($c);
2929
var_dump(json_last_error(), json_last_error_msg());

ext/json/tests/bug54484.phpt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@ var_dump(json_last_error());
1010
json_decode("");
1111
var_dump(json_last_error());
1212

13-
1413
json_decode("invalid json");
1514
var_dump(json_last_error());
1615

17-
1816
json_decode("\"\001 invalid json\"");
1917
var_dump(json_last_error());
2018

21-
2219
json_decode("");
2320
var_dump(json_last_error());
2421
?>

ext/json/tests/bug61978.phpt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ Bug #61978 (Object recursion not detected for classes that implement JsonSeriali
66
<?php
77

88
class JsonTest1 {
9-
public $test;
10-
public $me;
11-
public function __construct() {
12-
$this->test = '123';
13-
$this->me = $this;
14-
}
9+
public $test;
10+
public $me;
11+
public function __construct() {
12+
$this->test = '123';
13+
$this->me = $this;
14+
}
1515
}
1616

1717
class JsonTest2 implements JsonSerializable {
18-
public $test;
19-
public function __construct() {
20-
$this->test = '123';
21-
}
22-
public function jsonSerialize() {
23-
return array(
24-
'test' => $this->test,
25-
'me' => $this
26-
);
27-
}
18+
public $test;
19+
public function __construct() {
20+
$this->test = '123';
21+
}
22+
public function jsonSerialize() {
23+
return array(
24+
'test' => $this->test,
25+
'me' => $this
26+
);
27+
}
2828
}
2929

3030

ext/json/tests/bug62369.phpt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ FR #62369 (Segfault on json_encode(deeply_nested_array)
66
<?php
77

88
$array = array();
9-
for ($i=0; $i<550; $i++) {
10-
$array = array($array);
9+
for ($i=0; $i < 550; $i++) {
10+
$array = array($array);
1111
}
1212

1313
json_encode($array, 0, 551);
1414
switch (json_last_error()) {
15-
case JSON_ERROR_NONE:
16-
echo 'OK'.PHP_EOL;
17-
break;
18-
case JSON_ERROR_DEPTH:
19-
echo 'ERROR'.PHP_EOL;
20-
break;
15+
case JSON_ERROR_NONE:
16+
echo 'OK' . PHP_EOL;
17+
break;
18+
case JSON_ERROR_DEPTH:
19+
echo 'ERROR' . PHP_EOL;
20+
break;
2121
}
2222

2323
json_encode($array, 0, 540);
2424
switch (json_last_error()) {
25-
case JSON_ERROR_NONE:
26-
echo 'OK'.PHP_EOL;
27-
break;
28-
case JSON_ERROR_DEPTH:
29-
echo 'ERROR'.PHP_EOL;
30-
break;
25+
case JSON_ERROR_NONE:
26+
echo 'OK' . PHP_EOL;
27+
break;
28+
case JSON_ERROR_DEPTH:
29+
echo 'ERROR' . PHP_EOL;
30+
break;
3131
}
3232
--EXPECTF--
3333
OK

ext/json/tests/bug63737.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Bug #63737 (json_decode does not properly decode with options parameter)
55
--FILE--
66
<?php
77
function decode($json) {
8-
$x = json_decode($json);
9-
var_dump($x);
10-
$x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
11-
var_dump($x);
8+
$x = json_decode($json);
9+
var_dump($x);
10+
$x = json_decode($json, false, 512, JSON_BIGINT_AS_STRING);
11+
var_dump($x);
1212
}
1313

1414
decode('123456789012345678901234567890');

ext/json/tests/bug64874_part1.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitiv
55
--FILE--
66
<?php
77
function decode($json) {
8-
var_dump(json_decode($json));
9-
var_dump(json_last_error() !== 0);
10-
echo "\n";
8+
var_dump(json_decode($json));
9+
var_dump(json_last_error() !== 0);
10+
echo "\n";
1111
}
1212

1313
// Leading whitespace should be ignored

ext/json/tests/bug64874_part2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Case-sensitivity part of bug #64874 ("json_decode handles whitespace and case-se
55
--FILE--
66
<?php
77
function decode($json) {
8-
var_dump(json_decode($json));
9-
echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
8+
var_dump(json_decode($json));
9+
echo ((json_last_error() !== 0) ? 'ERROR' : 'SUCCESS') . PHP_EOL;
1010
}
1111

1212
// Only lowercase should work

ext/json/tests/bug66021.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Foo {
99
private $bar = 'baz';
1010
}
1111

12-
echo json_encode([[], (object)[], new Foo], JSON_PRETTY_PRINT), "\n";
12+
echo json_encode(array(array(), (object) array(), new Foo), JSON_PRETTY_PRINT);
1313

1414
?>
1515
--EXPECT--

ext/json/tests/fail001.phpt

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,44 @@
22
JSON (http://www.crockford.com/JSON/JSON_checker/test/fail*.json)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded('json')) die('skip: json extension not available');
5+
if (!extension_loaded('json')) die('skip');
66
?>
77
--FILE--
88
<?php
99

10-
$tests = array('"A JSON payload should be an object or array, not a string."',
11-
'["Unclosed array"',
12-
'{unquoted_key: "keys must be quoted}',
13-
'["extra comma",]',
14-
'["double extra comma",,]',
15-
'[ , "<-- missing value"]',
16-
'["Comma after the close"],',
17-
'["Extra close"]]',
18-
'{"Extra comma": true,}',
19-
'{"Extra value after close": true} "misplaced quoted value"',
20-
'{"Illegal expression": 1 + 2}',
21-
'{"Illegal invocation": alert()}',
22-
'{"Numbers cannot have leading zeroes": 013}',
23-
'{"Numbers cannot be hex": 0x14}',
24-
'["Illegal backslash escape: \\x15"]',
25-
'["Illegal backslash escape: \\\'"]',
26-
'["Illegal backslash escape: \\017"]',
27-
'[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
28-
'{"Missing colon" null}',
29-
'{"Double colon":: null}',
30-
'{"Comma instead of colon", null}',
31-
'["Colon instead of comma": false]',
32-
'["Bad value", truth]',
33-
"['single quote']");
10+
$tests = array(
11+
'"A JSON payload should be an object or array, not a string."',
12+
'["Unclosed array"',
13+
'{unquoted_key: "keys must be quoted}',
14+
'["extra comma",]',
15+
'["double extra comma",,]',
16+
'[ , "<-- missing value"]',
17+
'["Comma after the close"],',
18+
'["Extra close"]]',
19+
'{"Extra comma": true,}',
20+
'{"Extra value after close": true} "misplaced quoted value"',
21+
'{"Illegal expression": 1 + 2}',
22+
'{"Illegal invocation": alert()}',
23+
'{"Numbers cannot have leading zeroes": 013}',
24+
'{"Numbers cannot be hex": 0x14}',
25+
'["Illegal backslash escape: \\x15"]',
26+
'["Illegal backslash escape: \\\'"]',
27+
'["Illegal backslash escape: \\017"]',
28+
'[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]',
29+
'{"Missing colon" null}',
30+
'{"Double colon":: null}',
31+
'{"Comma instead of colon", null}',
32+
'["Colon instead of comma": false]',
33+
'["Bad value", truth]',
34+
"['single quote']"
35+
);
3436

35-
foreach ($tests as $test)
36-
{
37-
echo 'Testing: ' . $test . "\n";
38-
echo "AS OBJECT\n";
39-
var_dump(json_decode($test));
40-
echo "AS ARRAY\n";
41-
var_dump(json_decode($test, true));
37+
foreach ($tests as $test) {
38+
echo 'Testing: ' . $test . "\n";
39+
echo "AS OBJECT\n";
40+
var_dump(json_decode($test));
41+
echo "AS ARRAY\n";
42+
var_dump(json_decode($test, true));
4243
}
4344

4445
?>

0 commit comments

Comments
 (0)