From ebcca9e2c58818a13af5e43c13359a2382d235b2 Mon Sep 17 00:00:00 2001 From: jadenjoy Date: Sun, 19 Dec 2021 01:04:10 +0300 Subject: [PATCH] Hotfix for is_json function. Last version of this function will return true for any number also, and will convert any big numeric string into their scientific notation. --- src/Common/Common.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Common/Common.php b/src/Common/Common.php index d4f2e9a..61ef75d 100644 --- a/src/Common/Common.php +++ b/src/Common/Common.php @@ -60,7 +60,8 @@ protected static function is_json($str): bool if (!is_string($str)) { return false; } - return json_decode($str, true) !== null; + $json = json_decode($str); + return $json && $str != $json; } protected static function safeJson($jsonData, $asArray = false)