@@ 30-41 (lines=12) @@ | ||
27 | * |
|
28 | * @return object|array |
|
29 | */ |
|
30 | function json_decode(string $json, bool $assoc = false, int $depth = 512, int $options = 0) |
|
31 | { |
|
32 | error_clear_last(); |
|
33 | ||
34 | $result = original_json_decode($json, $assoc, $depth, $options); |
|
35 | ||
36 | if (null === $result) { |
|
37 | throw create_json_exception(); |
|
38 | } |
|
39 | ||
40 | return $result; |
|
41 | } |
|
42 | ||
43 | function json_encode($value, int $options = 0, int $depth = 512): string |
|
44 | { |
|
@@ 43-54 (lines=12) @@ | ||
40 | return $result; |
|
41 | } |
|
42 | ||
43 | function json_encode($value, int $options = 0, int $depth = 512): string |
|
44 | { |
|
45 | error_clear_last(); |
|
46 | ||
47 | $result = original_json_encode($value, $options, $depth); |
|
48 | ||
49 | if (false === $result) { |
|
50 | throw create_json_exception(); |
|
51 | } |
|
52 | ||
53 | return $result; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * @internal |