Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-10-08 Thread juan carlos morales
The RFC got accepted and merge. Thanks for contributing :)

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-10-07 Thread James Gilliland
Don't think it makes a difference to the discussion at this point but just thought I'd point out there's another example missing from the RFC list that almost everyone probably has installed with their projects. https://github.com/sebastianbergmann/phpunit/blob/main/src/Framework/Constraint/String

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-09-21 Thread juan carlos morales
The RFC is in voting phase now. I want to thank everyone involved in the discussions related to this RFC, the ones who reviewed the code in advance, and the ones that with some emojis in github showed their interest and support. -- PHP Internals - PHP Runtime Development Mailing List To unsubscr

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-09-20 Thread Tim Düsterhus
Hi On 9/20/22 00:15, juan carlos morales wrote: The RFC still contains a non-empty "Open Issues" section. This needs to be resolved before the vote starts. I would also recommend inserting a closed voting widget (or multiple, if you want to have additional votes for the details), so that it's c

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-09-19 Thread juan carlos morales
> The RFC still contains a non-empty "Open Issues" section. This needs to > be resolved before the vote starts. > > I would also recommend inserting a closed voting widget (or multiple, if > you want to have additional votes for the details), so that it's clear > for everyone how exactly the vote w

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-09-19 Thread Tim Düsterhus
Hi On 9/19/22 23:26, juan carlos morales wrote: It appears the discussion came to a halt. How do you plan to proceed with your RFC? Thanks for the heads up email Tim. People, following the procedure, this is a "heads up" email to all of you regarding this RFC. If no significant issue/complain

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-09-19 Thread juan carlos morales
> It appears the discussion came to a halt. How do you plan to proceed > with your RFC? Thanks for the heads up email Tim. People, following the procedure, this is a "heads up" email to all of you regarding this RFC. If no significant issue/complain raises, then I will move the RFC for voting by

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-09-19 Thread Tim Düsterhus
Hi On 8/25/22 18:02, juan carlos morales wrote: I am glad to present to you the RFC for json_validate() function. It appears the discussion came to a halt. How do you plan to proceed with your RFC? Best regards Tim Düsterhus -- PHP Internals - PHP Runtime Development Mailing List To unsubs

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-29 Thread juan carlos morales
El lun, 29 ago 2022 a las 11:26, Deleu () escribió: > > > > On Mon, Aug 29, 2022 at 11:19 AM juan carlos morales > wrote: >> >> El lun, 29 ago 2022 a las 11:06, Deleu () escribió: >> > >> > Has the option of returning a Result object been discussed/considered? Can >> > it be an option? I imagine

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-29 Thread juan carlos morales
El lun, 29 ago 2022 a las 11:06, Deleu () escribió: > > Has the option of returning a Result object been discussed/considered? Can it > be an option? I imagine that if `json_validate(): JsonValidationResult` > always returns a `JsonValidationResult` which contains a `public readonly > bool $vali

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-29 Thread Deleu
On Mon, Aug 29, 2022 at 10:50 AM juan carlos morales < dev.juan.mora...@gmail.com> wrote: > There is still 1 open question on the RFC, and is about the return value. > > https://wiki.php.net/rfc/json_validate#open_issuesquestions > > I would appreciate your feedback on this. Even though I was told

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-29 Thread juan carlos morales
There is still 1 open question on the RFC, and is about the return value. https://wiki.php.net/rfc/json_validate#open_issuesquestions I would appreciate your feedback on this. Even though I was told the RFC can go with 2 votings, I would like to know your thoughts about that open question, in sho

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-29 Thread juan carlos morales
El sáb, 27 ago 2022 a las 2:50, David Gebler () escribió: > > 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. Thanks for the advice I di

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread David Gebler
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

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
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: 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

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El sáb, 27 ago 2022 a las 1:31, juan carlos morales () escribió: > > === Open issues/concerns === > > > @@@ Usage of JSON_INVALID_UTF8_IGNORE @@@ > > - I have my doubts now, because of this codes: > > ``` > > var_dump(json_validate("\"a\xb0b\""), json_last_error_msg()); > var_dump("");

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
I now provide an update of the discussion. The good, the bads, the open questions, etc. All of this will go into the RFC also, as requested by the procedure in https://wiki.php.net/rfc/howto "Listen to the feedback, and try to answer/resolve all questions. Update your RFC to document all the iss

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Larry Garfield
On Fri, Aug 26, 2022, at 1:41 PM, Ayesh Karunaratne wrote: >> whether returning boolean is the right thing to do at all. It seems obviously >> intuitive it should, returning true for valid and false for invalid JSON >> but then if you consider you're still going to be in the situation of >> calling

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Derick Rethans
On 26 August 2022 18:28:59 BST, Kamil Tekiela wrote: >What is the reasoning behind the name? I can't find it explained in the >RFC. What about other alternatives like is_json or validate_json? It's part of the json extension so it should start with json_ following naming guidelines for functions

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Ayesh Karunaratne
> whether returning boolean is the right thing to do at all. It seems obviously > intuitive it should, returning true for valid and false for invalid JSON > but then if you consider you're still going to be in the situation of > calling json_last_error() if you want to know why invalid JSON was inv

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread David Gebler
On Fri, Aug 26, 2022 at 6:29 PM Kamil Tekiela wrote: > What is the reasoning behind the name? I can't find it explained in the > RFC. What about other alternatives like is_json or validate_json? > The name json_validate makes most sense to me; it groups itself together nicely with the other json

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Kamil Tekiela
What is the reasoning behind the name? I can't find it explained in the RFC. What about other alternatives like is_json or validate_json?

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Larry Garfield
On Fri, Aug 26, 2022, at 4:00 AM, Michał Marcin Brzuchalski wrote: > A `json_decode()` is a substitute that IMO solves 99% of use cases. > If I'd follow your logic and accept every small addition that handles 1% of > use cases, somebody will raise another RFC > for simplexml_validate_string or yam

RE: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Jeffrey Dafoe
> -Original Message- > From: juan carlos morales > Sent: Thursday, August 25, 2022 12:02 PM > To: PHP Internals List > Subject: [PHP-DEV] RFC json_validate() - status: Under Discussion > > Hello. > > I am glad to present to you the RFC for json_validat

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie., 26 de agosto de 2022 13:08, juan carlos morales < dev.juan.mora...@gmail.com> escribió: > > Is there a better way to do validation other than json_decode? > Better way than json_decode... Always from the core perspective >

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
Just Want to remind that this discussion is not about "a json parser can be written in PHP or not?". We Have a JSON parser already in the core, ready to be use for validation. Does it make sense to have another parser in User land to do validation if We already have one? Is there a better way to

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Michał Marcin Brzuchalski
Hi Tim, pt., 26 sie 2022 o 12:15 Tim Düsterhus napisał(a): > Hi > > On 8/26/22 11:14, Hans Henrik Bergan wrote: > >> you can't efficiently validate JSON in userland > > > > Has anyone actually put that claim to the test? Has anyone actually made > a > > userland json validator (not just wrap jso

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Tim Düsterhus
Hi On 8/26/22 11:00, Michał Marcin Brzuchalski wrote: A `json_decode()` is a substitute that IMO solves 99% of use cases. If I'd follow your logic and accept every small addition that handles 1% of use cases, somebody will raise another RFC for simplexml_validate_string or yaml_validate and the

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Tim Düsterhus
Hi On 8/26/22 11:14, Hans Henrik Bergan wrote: you can't efficiently validate JSON in userland Has anyone actually put that claim to the test? Has anyone actually made a userland json validator (not just wrap json_decode()/json_last_error()) for performance comparison? ( if not, https://www.js

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Tim Düsterhus
Hi On 8/26/22 10:56, Paul Crovella wrote: I'm for this as well. Though something more than a boolean is useful to indicate when the max depth has been exceeded as that's not strictly a problem with the json's validity. Yes, it's not strictly invalid JSON, but I expect json_validate() to be u

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 11:55, Peter Bowyer () escribió: > > That's a good point which I had overlooked. Does an exception make most > sense when this happens? > > Peter I just got a code review from Derick Rethans explaining me that a validation routine should not throw an exception. I think i

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Peter Bowyer
On Fri, 26 Aug 2022 at 09:56, Paul Crovella wrote: > I'm for this as well. Though something more than a boolean is useful to > indicate when the max depth has been exceeded as that's not strictly a > problem with the json's validity. > That's a good point which I had overlooked. Does an exceptio

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 11:43, Andreas Leathley () escribió: > > On 26.08.22 11:00, Michał Marcin Brzuchalski wrote: > > There is already a way to validate XML in PHP, and Yaml or PHP is > something within the control of a PHP programmer, while JSON is mostly > used as a format for communication

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 11:35, Michał Marcin Brzuchalski () escribió: > Your examples are a couple of functions. > Assuming that they're heavily used is as true as my assumptions. > > Cheers, Is good you clarify that your numbers were assumptions. By the way, I never said anything about how my

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Andreas Leathley
On 26.08.22 11:00, Michał Marcin Brzuchalski wrote: A `json_decode()` is a substitute that IMO solves 99% of use cases. If I'd follow your logic and accept every small addition that handles 1% of use cases, somebody will raise another RFC for simplexml_validate_string or yaml_validate and the nex

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Michał Marcin Brzuchalski
Hi Juan, pt., 26 sie 2022 o 11:26 juan carlos morales napisał(a): > El vie, 26 ago 2022 a las 11:00, Michał Marcin Brzuchalski > () escribió: > > > > A `json_decode()` is a substitute that IMO solves 99% of use cases. > > If I'd follow your logic and accept every small addition that handles 1% >

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 11:26, juan carlos morales () escribió: > > How can you make such an assertion in those numbers (99% of use cases > and son on, that you mention) ? Can you give us more information about > this assertions? > > I have provide real examples where the need to validate-only a

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 11:00, Michał Marcin Brzuchalski () escribió: > > A `json_decode()` is a substitute that IMO solves 99% of use cases. > If I'd follow your logic and accept every small addition that handles 1% of > use cases, somebody will raise another RFC > for simplexml_validate_string

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 10:56, Paul Crovella () escribió: > > I'm for this as well. Though something more than a boolean is useful to > indicate when the max depth has been exceeded as that's not strictly a > problem with the json's validity. Thanks, seems to be good idea to take it out, and I w

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread juan carlos morales
El vie, 26 ago 2022 a las 10:28, Peter Bowyer () escribió: > > Hi Juan, > > On Thu, 25 Aug 2022 at 17:02, juan carlos morales > wrote: >> >> RFC: https://wiki.php.net/rfc/json_validate > > > Thanks for bringing forward this RFC. I am in favour of this change, as you > can't efficiently validate

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Hans Henrik Bergan
quote > you can't efficiently validate JSON in userland Has anyone actually put that claim to the test? Has anyone actually made a userland json validator (not just wrap json_decode()/json_last_error()) for performance comparison? ( if not, https://www.json.org/JSON_checker/JSON_checker.c would p

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Michał Marcin Brzuchalski
Hi Dusk, pt., 26 sie 2022 o 08:17 Dusk napisał(a): > On Aug 25, 2022, at 21:47, Michał Marcin Brzuchalski < > michal.brzuchal...@gmail.com> wrote: > > The same goes here and I'm not convinced we should introduce next small > function that can be simply implemented in user land. > > What "simple

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Paul Crovella
On 8/26/2022 1:28 AM, Peter Bowyer wrote: Hi Juan, On Thu, 25 Aug 2022 at 17:02, juan carlos morales < dev.juan.mora...@gmail.com> wrote: RFC: https://wiki.php.net/rfc/json_validate Thanks for bringing forward this RFC. I am in favour of this change, as you can't efficiently validate JSON i

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-26 Thread Peter Bowyer
Hi Juan, On Thu, 25 Aug 2022 at 17:02, juan carlos morales < dev.juan.mora...@gmail.com> wrote: > RFC: https://wiki.php.net/rfc/json_validate Thanks for bringing forward this RFC. I am in favour of this change, as you can't efficiently validate JSON in userland. Like Rowan I'm not convinced JS

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
El vie, 26 ago 2022 a las 6:47, Michał Marcin Brzuchalski () escribió: > > > I share the same opinion you expressed here even though you admit in recent > email that you changed your mind. > > In recent versions we tend to accept more and more small standard library > functions with IMO questiona

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread Dusk
On Aug 25, 2022, at 21:47, Michał Marcin Brzuchalski wrote: > The same goes here and I'm not convinced we should introduce next small > function that can be simply implemented in user land. What "simple implementation in userland" do you have in mind? Can you provide an example? json_decode()

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread Michał Marcin Brzuchalski
czw., 25 sie 2022, 21:12 użytkownik David Gebler napisał: > I'm not a voter on RFCs so my input may be largely irrelevant here but for > discussion purposes: > > I remain unconvinced regarding the justification for this proposal. I'm not > saying there's a strong reason to NOT implement it, but I

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
> Having actually compiled the branch and tried it out, I have to say > regardless of whether validating arbitrarily large blocks of JSON without > being interested in the contents is a common or more niche use case, the > memory savings ARE highly impressive. I had thought that because the func

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread David Gebler
Having actually compiled the branch and tried it out, I have to say regardless of whether validating arbitrarily large blocks of JSON without being interested in the contents is a common or more niche use case, the memory savings ARE highly impressive. I had thought that because the function was bu

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
I also added in the RFC your concern about JSON_THROW_ON_ERROR usage. 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

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
Ok then ... I take it out of the RFC just because we have doubts about it. 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

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread Rowan Tommins
[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 yo

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
Hey Tim, thanks a lot for participating and taking your time to use the code and making your own tests, I highly appreciate it. Regards. RFC: https://wiki.php.net/rfc/json_validate Implementation: https://github.com/php/php-src/pull/9399 -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
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 t

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread Rowan Tommins
On 25/08/2022 17:02, juan carlos morales wrote: I am glad to present to you the RFC for json_validate() function. RFC: https://wiki.php.net/rfc/json_validate Hi, Leaving aside the overall question of inclusion and looking at details, I'm not convinced JSON_THROW_ON_ERROR belongs here. Wit

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread Tim Düsterhus
Hi On 8/25/22 21:11, David Gebler wrote: There are many examples of userland code which could be faster and more memory efficient if they were written in C and compiled in, so the mere fact this proposal may introduce a somewhat faster way of validating a JSON string over decoding it is not nece

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
Thanks for participating. Cheers. RFC: https://wiki.php.net/rfc/json_validate Implementation: https://github.com/php/php-src/pull/9399

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
Hello David, thanks for your feedback. I believe that the answer to most of your concerns/questions related to other projects that would benefit out of something like this is already answered by me in the RFC. I mentioned major PHP projects that will directly benefit out of something like this. A

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread Deleu
On Thu, Aug 25, 2022, 9:12 PM David Gebler wrote: > > I agree that the number of userland implementations for a "is_valid_json" > type function including in some widely used frameworks and systems > indicates there's some degree of demand in the ecosystem for validating a > JSON string. > I don'

Re: [PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread David Gebler
I'm not a voter on RFCs so my input may be largely irrelevant here but for discussion purposes: I remain unconvinced regarding the justification for this proposal. I'm not saying there's a strong reason to NOT implement it, but I'm not convinced it's really going to be a significant benefit to man

[PHP-DEV] RFC json_validate() - status: Under Discussion

2022-08-25 Thread juan carlos morales
Hello. I am glad to present to you the RFC for json_validate() function. The code/implementation still needs some workout, but seems to be fine enough to be presented to you all. I look forward for feedback Thanks in advance. Juan. RFC: https://wiki.php.net/rfc/json_validate Implementation: