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

Description

According to the JSON-RPC http://groups.google.com/group/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.

Comments

I reported the same issue (http://framework.zend.com/issues/browse/ZF-11991), 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.