Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Routing groups and in-group routes use filters that are only effective within the group. #9063

Closed
fxnetw opened this issue Jul 22, 2024 · 1 comment · Fixed by #9064
Closed
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@fxnetw
Copy link

fxnetw commented Jul 22, 2024

PHP Version

8.1

CodeIgniter4 Version

4.5.3

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MySQL 5.7

What happened?

When I use a route group filter, and then use the filter on the routes within the route group, it only takes effect on the filters within the group.

Steps to Reproduce

//Routers

$routes->group('',['filter'=>['auth']],function($routes){
    $routes->get('getuserinfo','Mmeber::getUserInfo',['filter'=>['throttle']]);
});

Use filter:check output:

+--------+--------------+------------------------------------------+----------------------------------------+
| Method | Route        | Before Filters                           | After Filters                          |
+--------+--------------+------------------------------------------+----------------------------------------+
| GET    | /getuserinfo | forcehttps pagecache csrf token throttle | throttle pagecache performance toolbar |
+--------+--------------+------------------------------------------+----------------------------------------+

The csrf,token is globals filter,I think the filter execution order should be from the route group to the route within the group.For example:csrf->token->auth->throttle.But it does not include the route group filter.

Expected Output

I want the filter to include the route group filter.

The above content is translated by Google, so there may be some errors, but I hope this error can be fixed.

Anything else?

No response

@fxnetw fxnetw added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 22, 2024
@kenjis
Copy link
Member

kenjis commented Jul 23, 2024

Thank you for reporting!
Check #9064

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
2 participants