ZF-7765: Zend_Rest_Route maps actions, but not request methods.


Zend_Rest_Route maps REST actions to request, bases on "_server" hidden field/X-HTTP-Method-Override, but not request methods. In that case, Zend_Controller_Request_Http::isPut() and Zend_Controller_Request_Http::isDelete() methods will return false.

Also, Zend_Rest_Route doesn't map a DELETE request method, so deleteAction() will never be invoked.


There are several solutions to solve this issue. First is a 'dirty' patch for Zend_Rest_Route, second patch is both for Zend_Rest_Route and Zend_Controller_Request_Http.

I can provide these patches.

I have not experienced this at all. I've been using Dojo's JsonRestStore with Zend_Rest_Route extensively, and all PUT and DELETE requests are routed accordingly; the X-HTTP-Method-Override header is not present in these requests, either, indicating that the routing is being done exclusively based on the actual request method (as it should).

Can you provide some example code that displays the issue?

Sorry, my bad - i just noticed DELETE-actions works fine, but only if uses with _method field :

$this->addElement('hidden', '_method', array(
            'value' => 'delete',

I also found Zend_Form handles PUT/DELETE as GET methods. Is it a bug, or feature? Need i create a new ticket for this?

I mean, maybe will be better for Zend_Form to check setted method and add a hidden '_method' field automatically? In other case i don't see a point why PUT/DELETE methods were added to Zend_Form.

I don't know much about how Zend_Form works, but it's something we could/should investigate to make sure the two components work well together.

Luke, as i found since 1.9 in Zend_Form was implemented new request methods, PUT and DELETE, for REST complatiblity. As i guess, when using this request methods, Zend_Form should generate additional hidden field named '_method' with related value for route matching. Also, Zend_Form should always set POST request method in rendered HTML for REST method tunneling. In fact, Zend_Form doesn't fulfill it.

I think it can be repaired in two ways: 1. Additional form decorator(no matter if it will work even without REST routing enabled). 2. Rewriting of Zend_Form_Decorator_Form.

So it sounds like this one is a problem in Zend_Form, not Zend_Rest_Route ? Is there a Zend_Form ticket to which I can associate this one, and then mark this one as duplicate?

thanks, -L

Good day, Luke. Thank you for help with ZF-7771. Yes, i created a ticket: ZF-7791.

Quick info : W3C's HTML 5 provide a text for adding PUT and DELETE capabilities to


form> elements More infos can be found here :…

Bulk change of all issues last updated before 1st January 2010 as "Won't Fix".

Feel free to re-open and provide a patch if you want to fix this issue.