-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugVerified issues on the current code behavior or pull requests that will fix themVerified issues on the current code behavior or pull requests that will fix them
Description
PHP Version
8.2
CodeIgniter4 Version
4.5.0
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
Mysql 8
What happened?
When defining a custom filter in app/Config/Filters.php with specific URI patterns and using the codeigniter4/shield package for authentication, the Debug Toolbar throws a TypeError if the filter triggers a redirect. This issue seems to arise from how the Debug Toolbar processes responses, particularly when a controller or filter returns a non-standard response or null.
Steps to Reproduce
- In app/Config/Filters.php, define a before filter rule for specific paths, excluding some with a regex pattern, as shown below:
public array $filters = [ 'session' => [ 'before' => [ '^myadminendpoint(?!/login|/register|/auth/a/)([a-zA-Z0-9/-]+)?$', ] ] ]; - Ensure the before filter (e.g., session filter from codeigniter4/shield) is configured to return a redirect under certain conditions.
- Access a URL that matches the filter's criteria and triggers the redirect.
Expected Output
The application should redirect to the specified location without any errors, even with the Debug Toolbar enabled.
Anything else?
Workaround
Temporarily removing the Debug Toolbar from the $globals and $required arrays in the after filters configuration resolves the issue.
Metadata
Metadata
Assignees
Labels
bugVerified issues on the current code behavior or pull requests that will fix themVerified issues on the current code behavior or pull requests that will fix them
