Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Fix #6385 Request exception #6409

Conversation

stefanotorresi
Copy link
Contributor

this PR fixes #6385 .

The idea suggested by @weierophinney is to loosen the strictness of Zend\Http\Request to get rid of the uncaught exception, and then add an event listener to the mvc cycle to give users some flexibility and feedback (that will be done in a different PR against develop).

There is a catch that I leave for discussion, tho.

Personally, I can't see any reason why one would want to have Application::construct() trigger a fatal error if a bogus http method was set in the server environment, but - although unlikely - it's possible that people could rely on the exceptions thrown by Request::setMethod() and Request::fromString() when using Zend\Http component alone. One example is Zend\Http\Client itself, as shown in this PR.

It may be worth mentioning that this behaviour wasn't covered by the Request tests themselves, but it was in Client ones. Overall I'd say dropping some strictness seems legit, but I can see why it may be undesirable.

As an alternative, it's totally possible to set the flag strict by default, and open it up in Zend\Mvc\Service\RequestFactory instead. That could preserve the old behaviour of Zend\Http component and at the same time make Application behaviour more sane.

@ezimuel
Copy link
Contributor

ezimuel commented Aug 6, 2014

@weierophinney can you review this PR? Thanks.

@ezimuel ezimuel added this to the 2.4.0 milestone Aug 6, 2014
@Ocramius
Copy link
Member

Ocramius commented Aug 6, 2014

I'm actually merging this, as I don't see a reason why a request couldn't have a custom HTTP method.

@Ocramius Ocramius self-assigned this Aug 6, 2014
Ocramius added a commit that referenced this pull request Aug 6, 2014
@Ocramius
Copy link
Member

Ocramius commented Aug 6, 2014

Rebased and manually merged into develop at 5186398, thanks!

@Ocramius
Copy link
Member

This is supposed to be closed, wasn't automatically done by the commit.

@Ocramius Ocramius closed this Nov 17, 2014
freax pushed a commit to freax/zf2 that referenced this pull request Nov 27, 2014
@stefanotorresi stefanotorresi deleted the fix-6385-request-exception branch November 28, 2014 15:01
gianarb pushed a commit to zendframework/zend-http that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-http that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

\Zend\Http\Request - Uncaught InvalidArgumentException when the request method is not considered valid.
3 participants