ZF-4053: Silence cycle exception in Zend_Json_Encoder
Description
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
"* RECURSION ([Class Name]) *"
into the JSON string.
To accomplish this we could use:
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.
Zend_Json_Encoder::encode($value, Zend_Json_Encoder::SILENT_CYCLE_CHECK);
Comments
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.