note 125503 added to function.json-decode
| From: | Cristiano@php.net | Date: | Tue, 10 Nov 2020 10:00:54 +0000 |
| Subject: | note 125503 added to function.json-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215833@lists.php.net to get a copy of this message | ||
Any only-digit string will pass the check of the function, and json_last_error() won't report
anything.
To check if it's a valid json, it is mandatory to use: if (is_numeric($string)) return false;
https://stackoverflow.com/questions/6041741/fastest-way-to-check-if-a-string-is-json-in-php/6041773#6041773
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.174 (proxied: 188.152.37.56)
----
Manual Page -- http://php.net/manual/en/function.json-decode.php
Edit -- https://master.php.net/note/edit/125503
Del: integrated -- https://master.php.net/note/delete/125503/integrated
Del: useless -- https://master.php.net/note/delete/125503/useless
Del: bad code -- https://master.php.net/note/delete/125503/bad+code
Del: spam -- https://master.php.net/note/delete/125503/spam
Del: non-english -- https://master.php.net/note/delete/125503/non-english
Del: in docs -- https://master.php.net/note/delete/125503/in+docs
Del: other reasons-- https://master.php.net/note/delete/125503
Reject -- https://master.php.net/note/reject/125503
Search -- https://master.php.net/manage/user-notes.php