note 117023 deleted from function.json-encode by crell
| From: | crell@php.net | Date: | Thu, 30 Jun 2022 19:45:30 +0000 |
| Subject: | note 117023 deleted from function.json-encode by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218794@lists.php.net to get a copy of this message | ||
Note Submitter: Goran
----
This function has weird behavior regarding error reporting in PHP version 5.4 or lower. This kind of
warning is raised only if you configure PHP with "display_errors=Off" (!?): "PHP
Warning: json_encode(): Invalid UTF-8 sequence in argument ..."
You can reproduce this behavior:
<?php
// Warning not displayed, not logged
ini_set('display_errors', '1');
json_encode(urldecode('bad utf string %C4_'));
// Warning not displayed but logged
ini_set('display_errors', '0');
json_encode(urldecode('bad utf string %C4_'));
?>
This is considered feature - not-a-bug - by PHP devs:
https://bugs.php.net/bug.php?id=52397
https://bugs.php.net/bug.php?id=63004