Skip to content

Overriding Filters / Filter arguments no longer working in v4.6.0 #9422

Closed
@NSURLSession0

Description

@NSURLSession0

PHP Version

8.1

CodeIgniter4 Version

4.6.0

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

macOS, Linux

Which server did you use?

fpm-fcgi

Database

No response

What happened?

After change #8977 overriding filter arguments is no longer working.

Before I could do:

// Config/Routes.php
$routes->group('authentication', ['filter' => 'portal:public'], function ($routes) { // Pass argument 'public' to portal filter
    $routes->addRedirect('/', 'authentication/login');
});


// Config/Filters.php
public array $globals = [
    'before' => ['portal'], // Before 4.6.0, this filter would get overridden by the filter in Routes.php
    'after'  => [
    'secureheaders' => [],
        'toolbar' => [],
    ],
];

After the change in 4.6.0, the filter is called twice: once without the argument and once with the argument 'public'. If this is intentional, what should I do to get the old behavior back? I am using the old filter order ($oldFilterOrder = true), in case that matters.

Steps to Reproduce

Use the same filter in Routes.php and within globals in Filters.php, but use different arguments in both cases.

Expected Output

Arguments from globals are used when $oldFilterOrder is set to false. The value from routes is used when $oldFilterOrder is true. However, since version 4.6.0, the filters are executed twice, each with their own arguments.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions