Closed Pumpuli closed 6 years ago
Group middleware is added to the middleware stack twice and thus executed twice.
The problem areas seem to be:
RouteGroup#map()
https://github.com/thephpleague/route/blob/2320c573fa677f5fd65c40c18acf8c9e8720f9ae/src/RouteGroup.php#L90-L92
Dispatcher#setFoundMiddleware()
https://github.com/thephpleague/route/blob/2320c573fa677f5fd65c40c18acf8c9e8720f9ae/src/Dispatcher.php#L80-L85
Thanks for the detailed report.
Fixed here https://github.com/thephpleague/route/releases/tag/4.1.1
Group middleware is added to the middleware stack twice and thus executed twice.
The problem areas seem to be:
RouteGroup#map()
), the group's middleware is added to each route:https://github.com/thephpleague/route/blob/2320c573fa677f5fd65c40c18acf8c9e8720f9ae/src/RouteGroup.php#L90-L92
Dispatcher#setFoundMiddleware()
), but since route already contains group middleware, the group middleware gets added a second time:https://github.com/thephpleague/route/blob/2320c573fa677f5fd65c40c18acf8c9e8720f9ae/src/Dispatcher.php#L80-L85