note 124256 deleted from function.json-encode by crell
| From: | crell@php.net | Date: | Thu, 30 Jun 2022 19:48:19 +0000 |
| Subject: | note 124256 deleted from function.json-encode by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218797@lists.php.net to get a copy of this message | ||
Note Submitter: karsten at dambekalns dot de
----
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.