-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy path007.phpt
40 lines (38 loc) · 886 Bytes
/
007.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--TEST--
json_last_error() tests
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
var_dump(json_decode("[1]"));
var_dump(json_last_error(), json_last_error_msg());
var_dump(json_decode("[[1]]", false, 2));
var_dump(json_last_error(), json_last_error_msg());
var_dump(json_decode("[1}"));
var_dump(json_last_error(), json_last_error_msg());
var_dump(json_decode('["' . chr(0) . 'abcd"]'));
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--
array(1) {
[0]=>
int(1)
}
int(0)
string(8) "No error"
NULL
int(1)
string(28) "Maximum stack depth exceeded"
NULL
int(2)
string(42) "State mismatch (invalid or malformed JSON)"
NULL
int(3)
string(53) "Control character error, possibly incorrectly encoded"
NULL
int(4)
string(12) "Syntax error"
Done