Re: #45989

From: Date: Tue, 02 Dec 2008 21:43:37 +0000
Subject: Re: #45989
References: 1 2  Groups: php.qa 
Request: Send a blank email to php-qa+get-64542@lists.php.net to get a copy of this message
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? 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 (#64542) next »