Skip to content

Commit 22767a4

Browse files
committed
Merge branch 'PHP-5.6'
* PHP-5.6: Add tests for json_last_error()/json_last_error_msg() failures
2 parents 0c651cf + f18ba0f commit 22767a4

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
json_last_error() failures
3+
--SKIPIF--
4+
<?php !extension_loaded('json') && die('skip json extension not available') ?>
5+
--FILE--
6+
<?php
7+
8+
var_dump(json_last_error());
9+
var_dump(json_last_error(TRUE));
10+
var_dump(json_last_error('some', 4, 'args', 'here'));
11+
12+
13+
?>
14+
--EXPECTF--
15+
int(0)
16+
17+
Warning: json_last_error() expects exactly 0 parameters, 1 given in %s on line %d
18+
NULL
19+
20+
Warning: json_last_error() expects exactly 0 parameters, 4 given in %s on line %d
21+
NULL
22+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--TEST--
2+
json_last_error_msg() failures
3+
--SKIPIF--
4+
<?php !extension_loaded('json') && die('skip json extension not available') ?>
5+
--FILE--
6+
<?php
7+
8+
var_dump(json_last_error_msg());
9+
var_dump(json_last_error_msg(TRUE));
10+
var_dump(json_last_error_msg('some', 4, 'args', 'here'));
11+
12+
?>
13+
--EXPECTF--
14+
string(8) "No error"
15+
16+
Warning: json_last_error_msg() expects exactly 0 parameters, 1 given in %s on line %d
17+
NULL
18+
19+
Warning: json_last_error_msg() expects exactly 0 parameters, 4 given in %s on line %d
20+
NULL
21+

0 commit comments

Comments
 (0)