Fixes to issues are prioritized by severity; that said, they're also going to occur based on availability of the contributors/maintainers of the components in question. The easier it is for a contributor to reproduce the issue, the easier it will be for them to work on it.

Is there any chance you can simplify the reproduce case further?

Posted by Robert (rs) on 2010-03-13T10:49:30.000+0000

I attached already this 2 Files, including only a few files to reproduce the issue.
It should be very very easy to reproduce and debug it.

For my client SOA architecture this functionality is key.

Is there a timeframe which I can communicate anyhow?

br

Posted by Núria Aloy (nuqqsa) on 2010-04-14T15:04:23.000+0000

This bug is related to the fact that one of the classes is an instance of Iterator. In that case the encoder iterates the object itself instead of its variables to produce the JSON string.

ZF-9416.patch includes a test that demonstrates this bug. The problem relates to the fact that ArrayIterator gets encoded as an object in JSON, which requires a string key for each value. However, when an array without keys is encoded it is an array in JSON, which does not have keys. I'm not sure what the proper behavior should be. Do we convert numeric keys to strings and preserve it as an object? Do we embed an array within the JSON object and follow the same rules for encoding arrays?

I am going to follow this behavior in Zend_Json::encode and add the numeric keys as strings for safety.

Posted by Joel Clermont (jclermont) on 2010-05-20T17:14:04.000+0000

In the sample code, it is calling Json_Encoder and Json_Decoder directly. A better approach is to use Json::encode and Json::decode. This way, if you have json support in PHP it will use the native functions json_encode and json_decode. Not only is it faster, but this bug does not occur. The bug only exists in the internal class Json_Encoder (which I will soon fix).

Posted by Joel Clermont (jclermont) on 2010-05-20T17:56:54.000+0000

ZF-9416-2.patch fixes the bug and includes a better unit test. I fixed the bug by using the internal _encodeString function for keys within an object, since JSON requires that object keys always be strings. This handles the encoding of numeric keys in the same way as the native json_encode feature now. Unit test now passes. Should be ready to commit.

Posted by Joel Clermont (jclermont) on 2010-06-04T19:14:14.000+0000

Unit test written to demonstrate the problem and prove that the patch fixes it. Please use the ZF-9416-2.patch file.

Posted by Ralph Schindler (ralph) on 2010-06-18T11:18:47.000+0000

Was not resolved in code (yet).

Posted by Ralph Schindler (ralph) on 2010-06-18T11:19:33.000+0000

Resolved in r22452 in trunk and in r22453 in release branch 1.10 with patch "-2" from above.