note 124256 added to function.json-encode
| From: | karsten at dambekalns dot de | Date: | Tue, 01 Oct 2019 09:17:16 +0000 |
| Subject: | note 124256 added to function.json-encode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-212447@lists.php.net to get a copy of this message | ||
Be aware that when an error occurs, the return value might be NULL unexpectedly. Example: When
running this on PHP < 7.3, you do not get back a string:
json_encode('ok', JSON_THROW_ON_ERROR, 512);
The constant not being available produces a warning and results in NULL being returned (see https://3v4l.org/ku5AH) â I'd expect false, since
that's a failure, or "ok" as the encoded result. YMMV.
----
Server IP: 208.43.231.9
Probable Submitter: 185.85.3.195 (proxied: 2a02:8106:14:c700:79c6:db86:6289:37df)
----
Manual Page -- http://php.net/manual/en/function.json-encode.php
Edit -- https://master.php.net/note/edit/124256
Del: integrated -- https://master.php.net/note/delete/124256/integrated
Del: useless -- https://master.php.net/note/delete/124256/useless
Del: bad code -- https://master.php.net/note/delete/124256/bad+code
Del: spam -- https://master.php.net/note/delete/124256/spam
Del: non-english -- https://master.php.net/note/delete/124256/non-english
Del: in docs -- https://master.php.net/note/delete/124256/in+docs
Del: other reasons-- https://master.php.net/note/delete/124256
Reject -- https://master.php.net/note/reject/124256
Search -- https://master.php.net/manage/user-notes.php