Issues

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

Issue Type: Bug Created: 2009-09-03T02:51:59.000+0000 Last Updated: 2012-11-20T20:53:07.000+0000 Status: Closed Fix version(s): Reporter: Alex Zinchenko (admloki) Assignee: None Tags: - Zend_Controller

  • Zend_Rest_Route

Related issues: - ZF-7791

Attachments:

Description

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.

Comments

Posted by Alex Zinchenko (admloki) on 2009-09-03T05:10:20.000+0000

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.

Posted by Matthew Weier O'Phinney (matthew) on 2009-09-03T05:36:41.000+0000

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?

Posted by Alex Zinchenko (admloki) on 2009-09-03T06:21:46.000+0000

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

<pre class="highlight">
$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?

Posted by Alex Zinchenko (admloki) on 2009-09-03T06:43:00.000+0000

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.

Posted by Luke Crouch (lcrouch) on 2009-09-03T08:02:58.000+0000

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.

Posted by Alex Zinchenko (admloki) on 2009-09-03T08:45:07.000+0000

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.

Posted by Luke Crouch (lcrouch) on 2009-09-07T06:29:13.000+0000

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

Posted by Alex Zinchenko (admloki) on 2009-09-07T06:42:39.000+0000

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

Posted by julien PAULI (doctorrock83) on 2009-09-07T12:24:01.000+0000

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

<

form> elements More infos can be found here : http://w3.org/TR/html5/…

Posted by Rob Allen (rob) on 2012-11-20T20:53:07.000+0000

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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts