ZF-8725: Zend_Json_Server_Error does not allow application-defined error codes


According to the JSON-RPC… , error codes -32768 - -32000 are reserved for JSON-RPC server errors, but all other codes are valid for application-defined use. Currently Zend_Json_Server_Error only allows for server errors to be reported, converting all application errors to -32000.

This is quite obvious in Zend_Server_Json->fault() where the default code is '404', but is instantly converted to -32000 by Zend_Server_Json_Error.

It seems like the resolution should be to drop the current allowedCodes strategy, and simply check that the error code is an integer.


I reported the same issue (, but finding this issue dated Janurari 2010 does not make me very hopeful this will be fixed.

So I've decided we will program around it and not use fault(). It is however very dissapointing that a component so simple, an implementation of a spec so simple, can be so royally screwed up and then ignored.