1--TEST--
2Test json_decode() function : JSON_THROW_ON_ERROR flag
3--FILE--
4<?php
5
6try {
7    var_dump(json_decode("{", false, 512, JSON_THROW_ON_ERROR));
8} catch (JsonException $e) {
9    var_dump($e);
10}
11
12?>
13--EXPECTF--
14object(JsonException)#1 (7) {
15  ["message":protected]=>
16  string(12) "Syntax error"
17  ["string":"Exception":private]=>
18  string(0) ""
19  ["code":protected]=>
20  int(4)
21  ["file":protected]=>
22  string(%d) "%s"
23  ["line":protected]=>
24  int(%d)
25  ["trace":"Exception":private]=>
26  array(1) {
27    [0]=>
28    array(4) {
29      ["file"]=>
30      string(%d) "%s"
31      ["line"]=>
32      int(%d)
33      ["function"]=>
34      string(11) "json_decode"
35      ["args"]=>
36      array(4) {
37        [0]=>
38        string(1) "{"
39        [1]=>
40        bool(false)
41        [2]=>
42        int(512)
43        [3]=>
44        int(4194304)
45      }
46    }
47  }
48  ["previous":"Exception":private]=>
49  NULL
50}
51