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

Add documentation describing using Next handler in middlewares #187

Open
Xerkus opened this issue Jun 10, 2019 · 1 comment
Open

Add documentation describing using Next handler in middlewares #187

Xerkus opened this issue Jun 10, 2019 · 1 comment

Comments

@Xerkus
Copy link
Member

Xerkus commented Jun 10, 2019

Next handler in the pipeline passed as a second parameter to the middleware is not safe to invoke multiple times. What actually Next handler is is defined at runtime and is not guaranteed to be stateless, which can lead to undefined behavior.

For example, middleware designed to invoke Next handler second time will cause unintented side effects if Fail2Ban middleware is then registered next in the pipeline.

If handler needs to be invoked multiple times, it should be selected explicitly and injected as a direct dependency (directly or lazy way or as a proxy to a middleware pipe elsewhere, etc).

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-stratigility; a new issue has been opened at laminas/laminas-stratigility#5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants