Issue Type: Improvement Created: 2008-08-24T14:48:12.000+0000 Last Updated: 2008-09-02T10:39:40.000+0000 Status: Resolved Fix version(s): - 1.6.0 (02/Sep/08)
Reporter: Christoph Dorn (cadorn) Assignee: Christoph Dorn (cadorn) Tags: - Zend_Json
Related issues: Attachments:
I need a way to silence the exception thrown when cycle detection is switched on and one is detected in Zend_Json_Encoder.
This relates to issue ZF-4040.
The aim is to still generate a valid JSON string even if cycles are detected. In place of the repeated object we could insert
<pre class="highlight"> "* RECURSION ([Class Name]) *"
into the JSON string.
To accomplish this we could use:
<pre class="highlight"> protected function __construct($cycleCheck = false, $silenceCycleCheck = false)
or convert $_cycleCheck to an integer and introduce a Zend_Json_Encoder::SILENT_CYCLE_CHECK constant to avoid a new constructor/method argument.
<pre class="highlight"> Zend_Json_Encoder::encode($value, Zend_Json_Encoder::SILENT_CYCLE_CHECK);
Posted by Christoph Dorn (cadorn) on 2008-08-24T15:05:05.000+0000
Based on IRC discussion with Matthew we have decided to add an $options argument that accepts an associative array.
The option to silence the exception will be called "silenceCyclicalExceptions".
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:40.000+0000
Updating for the 1.6.0 release.
Have you found an issue?
See the Overview section for more details.