Description

I'm using ZF with Doctrine which is using PHP 5.3 Namespaces.
I want to encode an object using Zend_Json's embedded encoder. This encoder adds a '__classname' to every object which contains the get_class() value of the object. This results in malformed JSON because the backslashes aren't encoded properly.

Example: Encoding a class A\Entity\Foo is saved as {"__classname":"A\Entity\Foo"} without encoded backslashes. The correct encoding is {"__classname":"A\Entity\Foo"}.

My local workaround is a str_replace('\', '\\', get_class($value)) around the get_class() call.