ZF-2540: Support optional parameters in methods in Zend_Rest_Server


Zend_Rest_Server does not currently support optional parameters for REST methods. It currently requires all parameters to be passed to the method.

I have attached a small patch that enables support for optional parameters, and changed the error logic to only throw an error when one or more required parameters are mssing.


This patch adds optional argument support for Zend_Rest_Server.

This is an alternate patch for consideration. It only contains three new lines to support optional parameters.

If you are not able to commit a patch to trunk, you should un-assign the issue from you. Otherwise you should commit the patch. :-)

Thanks for the tip, Thomas! I don't have access to commit (yet), so I unassigned the issue.

Here is a comment from matthew:

We cannot use the patch as is. The functionality needs to be added at the Zend_Server_Reflection level (the patch provided is a band-aid and would not fix the same type of issue with the XML-RPC server). Additionally, the patches do notinclude unit tests, and we cannot integrate without unit tests.

So we will not add this patch as is... but see the benefit of functionality. We will cover this later on... Feel free to add this functionality the way matthew described.

Every help is appreciated.

What changes need to be done exactly on Zend_Server_Reflection? I'll add the unit tests too, just need to know what needs to be done on the Reflection side.

This feature has to be added to the Reflection Class which is the origin of Zend_Rest. So we have a solution for all classes which extend Zend_Server (Zend_Rest, Zend_XmlRpc, Zend_Server, Zend_Http...).

If you do not know what exactly to do, it would be best to ask Matthew in the webservices mailinglist as he is the Server-Guru ;-)

Scheduling for next minor release.

It seems ZF-1949 also fixed this issue.

Was already fixed by ZF-1949