diff options
author | Andrew Dolgov <[email protected]> | 2022-07-12 22:26:21 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-07-12 22:26:21 +0300 |
commit | 80d3db1dcf8fe9ca66d4e3f2e2116d3bc39ae2b4 (patch) | |
tree | 04b33bfb9c9368c4a31e287153abec690b9014e0 /vendor/thecodingmachine/safe/generated/json.php | |
parent | 4b6161892000cb2b8392dce92a9cf2cabdf2d20e (diff) |
upgrade idiorm to php8.1-patched version (aaronpk/idiorm)
Diffstat (limited to 'vendor/thecodingmachine/safe/generated/json.php')
-rw-r--r-- | vendor/thecodingmachine/safe/generated/json.php | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/vendor/thecodingmachine/safe/generated/json.php b/vendor/thecodingmachine/safe/generated/json.php index dad455ccd..76fc6c17e 100644 --- a/vendor/thecodingmachine/safe/generated/json.php +++ b/vendor/thecodingmachine/safe/generated/json.php @@ -8,7 +8,7 @@ use Safe\Exceptions\JsonException; * Returns a string containing the JSON representation of the supplied * value. * - * The encoding is affected by the supplied options + * The encoding is affected by the supplied flags * and additionally the encoding of float values depends on the value of * serialize_precision. * @@ -19,7 +19,7 @@ use Safe\Exceptions\JsonException; * * PHP implements a superset of JSON as specified in the original * RFC 7159. - * @param int $options Bitmask consisting of + * @param int $flags Bitmask consisting of * JSON_FORCE_OBJECT, * JSON_HEX_QUOT, * JSON_HEX_TAG, @@ -42,30 +42,10 @@ use Safe\Exceptions\JsonException; * @throws JsonException * */ -function json_encode($value, int $options = 0, int $depth = 512): string +function json_encode($value, int $flags = 0, int $depth = 512): string { error_clear_last(); - $result = \json_encode($value, $options, $depth); - if ($result === false) { - throw JsonException::createFromPhpError(); - } - return $result; -} - - -/** - * Returns the error string of the last json_encode or json_decode - * call, which did not specify JSON_THROW_ON_ERROR. - * - * @return string Returns the error message on success, "No error" if no - * error has occurred. - * @throws JsonException - * - */ -function json_last_error_msg(): string -{ - error_clear_last(); - $result = \json_last_error_msg(); + $result = \json_encode($value, $flags, $depth); if ($result === false) { throw JsonException::createFromPhpError(); } |