ZF-8918: missing thrown exception on decode invalid json

Issue Type: Bug Created: 2010-01-24T11:47:13.000+0000 Last Updated: 2010-01-25T11:56:25.000+0000 Status: Resolved Fix version(s): - 1.10.0 (27/Jan/10)

Reporter: Marc Bennewitz (private) (mabe) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Json

Related issues: Attachments: - ZF-8918.diff


Zend_Json::decode doesn't throw an exception on failure.

Additionally the return value of json_decode has changed on invalid data within ZF supported php versions:

<pre class="highlight">
var_dump(json_decode('invalid json'));
// -> NULL

<pre class="highlight">
var_dump(json_decode('invalid json'));
// -> string(16) "invalid json"


Posted by Marc Bennewitz (private) (mabe) on 2010-01-24T12:05:35.000+0000

Added a patch for build-in json_decode for php 5.2 & 5.3

Posted by Marc Bennewitz (private) (mabe) on 2010-01-24T16:24:52.000+0000

Is there a chance that this could solve with 1.10 because in base of this bug Zend_Serializer_Adapter_JsonTest::testUnserialzeInvalid fails on php < 5.3

Posted by Matthew Weier O'Phinney (matthew) on 2010-01-25T11:56:25.000+0000

Patch applied (with additional unit test) to trunk and 1.10 release branch.

Have you found an issue?

See the Overview section for more details.


© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.