-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
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.