Re: RFC json_validate() - status: Under Discussion
| From: | juan carlos morales | Date: | Fri, 26 Aug 2022 23:46:35 +0000 |
| Subject: | Re: RFC json_validate() - status: Under Discussion | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118526@lists.php.net to get a copy of this message | ||
OMG, I need to take a rest, sorry for this, here it goes again; the
about JSON_INVALID_UTF8_IGNORE opinion is the same, but previous code
was wrong
Code:
<?php
var_dump(json_decode("{ \"a\xb0b\" : \"dummy\" }", true, 512),
json_last_error_msg());
var_dump("------------");
var_dump(json_decode("{ \"a\xb0b\" : \"dummy\" }", true, 512,
JSON_INVALID_UTF8_IGNORE), json_last_error_msg());
Result:
NULL
string(56) "Malformed UTF-8 characters, possibly incorrectly encoded"
string(12) "------------"
array(1) { ["ab"]=> string(5) "dummy" }
string(8) "No error"
Saying so, now ... yes I support and think is NEEDED the usage of the
JSON_INVALID_UTF8_IGNORE , as json_validate() result goes in the same
direction with json_decode(). I think we need to have this flag.
RFC: https://wiki.php.net/rfc/json_validate
Implementation: https://github.com/php/php-src/pull/9399