Closed mathmarques closed 8 years ago
I think this is a fair assessment. I don't see why we have to finalize all routes instead of the one matching route. However, I don't think this is paramount for the 3.0.0 RTM release. Will move to the 3.1.0 milestone.
There are some edge cases such as sub requests, etc. We'd want to save the "finalized" state as a member variable in each route instance, and then finalize routes lazily on invocation. But a problem to be addressed later in 3.1.0 for sure.
I thought about sub requests and I moved the finalized state to Route class on my "fix" for Lazy resolving of route middlewares: https://github.com/mathmarques/Slim/commit/99a85f9f1fbabfde730e160898da0024e56c7bb3
@codeguy Is it too early for create a PR for change this finalize behavior? :)
Not too early. Just be prepared to potentially rebase your PR in the future.
If this is running successfully, we may as well just merge this into RC3 /cc @akrabat
@codeguy can we get this tested on an app that makes heavy use of middleware's first, both Route
and App
level middleware.
@silentworks For sure.
I just need to work on removing the \Slim\Router->finalize() (A lot os unit tests use this function and I just remove the content of it)
I'll make the changes and open a PR.
Fixed by #1632.
Why Slim needs to call all Routes->finalize() via \Slim\Router->finalize()? I tried to look for a reason but I did not find.
My question is because I'm trying to work around this issue: https://github.com/slimphp/Slim/issues/1604
Why not 'finalize' only the dispatched Route?