Juan, You can always offer two votes on the RFC - one for the function itself, then one for should it return boolean or return an int representing the json_last_error constants and let it be decided that way.
I think on the whole, I agree with the sentiment that returning boolean and checking json_last_error() on false is probably the best / least worst option. So if I could vote, I would vote yes and for the boolean option, with a secondary preference for returning int if boolean option is rejected. And I was unconvinced about the whole idea originally, so a good example of where positive, robust discussion can change someone's mind. Good luck with progressing the RFC, I don't think I have anything else to add. On Sat, Aug 27, 2022 at 12:46 AM juan carlos morales < dev.juan.mora...@gmail.com> wrote: > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >