You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which operating systems have you tested for this bug?
Windows
Which server did you use?
cli-server (PHP built-in webserver)
Database
MySQL 8.0.30
What happened?
I created a filter that should be run before and after each call to the application.
I added it to the "before" and "after" sections of the required filters in the Config/Filters.php file.
But when I try to call my application with a route that doesn't exist, only the 'before' part is executed.
Steps to Reproduce
1 - Create a filter and add it to required filters (both before & after)
2 - Call your app with an undefined route (e.g. GET http://myci4app/test)
Expected Output
I expect the after function to be called even if the route does not exist as suggested in the documentation
Anything else?
I'm in development ENVIRONMENT with cli-server for development purposes.
I didn't test this bug on another environment
According to my investigations:
The exception is thrown in Router.php L:222 in the "if no automatic routing" block. Then it goes to the display404errors function which raises another exception which is handled in CodeIgniter\Debug\Exceptions::exceptionHandler, causing it to lose the execution line in the main 'run' function.
The text was updated successfully, but these errors were encountered:
Sunchock
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Nov 28, 2024
Sunchock
changed the title
Bug: Route that does not exist (404) does not trigger the required filters
Bug: Route that does not exist (404) does not trigger the 'after' part in required filters
Nov 28, 2024
Based on how everything has always worked and the forum conversations, I believe everything is ok. I have sent a PR that will fix the note in the user guide.
PHP Version
8.3
CodeIgniter4 Version
4.5.5
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
cli-server (PHP built-in webserver)
Database
MySQL 8.0.30
What happened?
I created a filter that should be run before and after each call to the application.
I added it to the "before" and "after" sections of the required filters in the Config/Filters.php file.
But when I try to call my application with a route that doesn't exist, only the 'before' part is executed.
Steps to Reproduce
1 - Create a filter and add it to required filters (both before & after)
2 - Call your app with an undefined route (e.g. GET http://myci4app/test)
Expected Output
I expect the after function to be called even if the route does not exist as suggested in the documentation
Anything else?
I'm in development ENVIRONMENT with cli-server for development purposes.
I didn't test this bug on another environment
According to my investigations:
The exception is thrown in Router.php L:222 in the "if no automatic routing" block. Then it goes to the display404errors function which raises another exception which is handled in CodeIgniter\Debug\Exceptions::exceptionHandler, causing it to lose the execution line in the main 'run' function.
The text was updated successfully, but these errors were encountered: