Bug: [DebugBar] 4.5.0 TypeError: str_contains(): Argument #1 ($haystack) must be of type string, null given #8730
Labels
bug
Verified issues on the current code behavior or pull requests that will fix them
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
public array $filters = [ 'session' => [ 'before' => [ '^myadminendpoint(?!/login|/register|/auth/a/)([a-zA-Z0-9/-]+)?$', ] ] ];
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.
The text was updated successfully, but these errors were encountered: