zendframework / zend-stratigility

Middleware for PHP built on top of PSR-7 and PSR-15
BSD 3-Clause "New" or "Revised" License
235 stars 57 forks source link

Ensure that MiddlewarePipes are called as callables if an error is present #95

Closed weierophinney closed 7 years ago

weierophinney commented 7 years ago

As reported in zendframework/zend-expressive#416, error middleware nested inside a MiddlewarePipe was not being dispatched. This was due to the fact that Dispatch was identifying the pipeline as http-interop middleware, and thus dropping the $err argument (as interop middleware cannot accept that argument).

Theis patch updates Dispatch to check if the middleware is a MiddlewarePipe and a non-null $err is present; if so, it now dispatches it as callable middleware instead of as interop middleware.

weierophinney commented 7 years ago

@Ocramius Feedback incorporated; waiting for build, but should be ready for you to review.

Ocramius commented 7 years ago

@weierophinney awesome, thanks!

Note that this cannot be forward ported, as develop has no Dispatch class anymore.

weierophinney commented 7 years ago

Note that this cannot be forward ported, as develop has no Dispatch class anymore.

Yep - and hence the reason I could omit the TODO items. :smile: Should not affect merging from develop to master later.

Thanks for the review; I'll get a tag out shortly.

Ocramius commented 7 years ago

@weierophinney I'm currently tagging: want me to hold back?

weierophinney commented 7 years ago

Nope, go ahead, @Ocramius.