As designed controller_pre_dispatch can run more than once

digitalpoint

Well-known member
This very well might be by design, but I believe the behavior changed in 1.2 (fairly certain it didn't do it in 1.1)...

If you end up rerouting a controller, both the beginning and destination controller trigger the controller_pre_dispatch event listeners.

Realized this was happening now because I have something that happens within that event, but only on the 2nd page view. On the main forum page it would never happen because the first page view run controller_pre_dispatch twice (rerouting Index to Forum internally).

Maybe it's by design... but just in case it's not, here's the report. I worked around it by only allowing the my code to run once per request.
 
This is by design and as far as I know, this has happened since day 1.

Pre-dispatch is called before any action is called (by the front controller). When you return a reroute back to the front controller, it goes through the whole dispatch loop again.
 
Back
Top Bottom