Re: #45989

From: Date: Wed, 03 Dec 2008 09:52:52 +0000
Subject: Re: #45989
References: 1 2 3  Groups: php.qa 
Request: Send a blank email to php-qa+get-64543@lists.php.net to get a copy of this message
till wrote:
Hey, I've read the bug report again and it's like full of gibbrish -- apologies for that. My issue is inconsistent behaviour: While the function is not supposed to be a JSON validator, it sometimes acts like one, by returning "NULL" on certain strings. Now my issue is that whatever the function thinks (!) is an invalid JSON string, could be just some other string containing {}. So instead of "NULL" it should return whatever you passed into it - literal. Or, it should return NULL on all strings that are not JSON and hereby act as JSON validator. Behavior that is "suggested" by the examples in the manual. The behaviour is /slightly/ confusing. Does that make any more sense? What you say does make sense and I agree that behaviour is not consistent. But if a PHP developer has decided that the demonstrated behaviour is not a bug, then I will not commit a test that fails because of the inconsistency. It looks too much like trying get maintainers to fix code when they have already said they aren't going to.
If you really think this is a bug you need to persuade one of the developers that it is. Perhaps you would consider providing a patch to json.c that makes it work the way you think it should? Zoe
Cheers, Till On Tue, Dec 2, 2008 at 2:44 PM, zoe <zoe.slattery@googlemail.com> wrote:
Hi till I looked at this test and the associated bug. It's not clear to me that this is a bug, so I don't think I can commit the test. I'm copying Iliaa, I note that he was asked to re-open the bug and if he does so I'd be happy to commit the test. Thanks, Zoe
    
Hey,
I ran into a couple inconsistencies in json_decode() today. I found #45989[1] and noticed it had been bogus'd. The docs suggest[2] that json_decode() returns NULL if invalid JSON is fed into it and since the examples provided on the bug report all show up as invalid on jsonlint[3], I figured I could give it a try and write a test: http://friendpaste.com/jvxjF7N8 It's rather trivial, let me know what you think. Cheers, Till [1]: http://bugs.php.net/bug.php?id=45989 [2]: http://us.php.net/json_decode (see, Example #3) [3]: http://jsonlint.com/
      


« previous php.qa (#64543) next »