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