Details
Description
If a string passed to the Zend_Json::prettyPrint function contains any array or object notation ([{}]) the string is modified to display in the pretty print format. I don't think this function should change a value of any of the data passed to it, but just format any actual objects/arrays.
See the following php example:
$test = array('simple'=>'simple test string','stringwithjsonchars'=>'[1,2]');
$pretty = Zend_Json::prettyPrint(Zend_Json::encode($test), array("indent" => " "))
print_r($pretty);
/* Actual result:
{
"simple":"simple test string",
"stringwithjsonchars":"[
1,
2
] "
}
*/
/* Expected result:
{
"simple":"simple test string",
"stringwithjsonchars":"[1,2]"
}
*/
Confirmed in 1.11. Looks like basic regex is used in prettyPrint, which unfortunately treats all [{, the same regardless of where they appear. This function should either be removed completely or rewritten to work as promised.