Re: RFC json_validate() - status: Under Discussion
| From: | Rowan Tommins | Date: | Thu, 25 Aug 2022 21:15:42 +0000 |
| Subject: | Re: RFC json_validate() - status: Under Discussion | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118477@lists.php.net to get a copy of this message | ||
[Replying to list - make sure to hit "Reply List" or "Reply All", not "Reply" in your mail client]
On 25/08/2022 21:59, juan carlos morales wrote:
Hello Rowan thanks for participating. My answer for your comments would be: === Regarding JSON_THROW_ON_ERROR === I think is a valid point from your side, and I am open to change the implementation if the maintainers believe so. I leave it there as it existed in json_decode() and wanted to give the developer the option to use it or not. But as I said, you hae a valid point, that I also like.Just to clarify, "the maintainers" of PHP are basically everyone on this list, trying to reach a consensus; there isn't really any core group that makes the final decision. There is a binding vote at the end of the RFC process, but it's in principle just a way to measure that consensus.
=== Regarding the examples you mentioned === The one from humhub and Symfony http-kernel, yes you are right, I will take them out from the RFC right now. Nice catch. But the Magento one, I took a look again, and I still believe is right example, because the only reason is using json_decode() for, is to validate only. Am I missing something here?It's not entirely clear *what* that Magento code is doing, but it's definitely not just validation: the output of json_decode is passed to $this->_jsonEncoder->encode(); if it was just validating, it would return $input, or true. My guess is that like the Symfony example it is "pretty-printing" existing JSON strings. Regards, -- Rowan Tommins [IMSoP]