Skip to content

Bug: Route options filter didn't working  #2654

Description

@gaibz

I think I found a bug in Route options Filter ..

Using codeigniter 4.0 latest release from composer repository ..

I have the following config on my routes.php

$routes->post('closed/auth', 'Closed\Auth::auth', ['filter'=>'coba']);

and have the following config on my filters.php

public $aliases = [ 'coba' => \App\Filters\CobaFilter::class ];

and then on my CobaFilter.php under Filters folder

<?php

namespace App\Filters;

use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Filters\FilterInterface;

class CobaFilter implements FilterInterface
{
public function before(RequestInterface $request)
{
die($request); // not executed
}

public function after(RequestInterface $request, ResponseInterface $response)
{
return $response;
}
}`

But if i have group routes config it just work .. i.e (routes.php):

$routes->group('closed', ['filter'=>'coba'], function($routes)
{
$routes->post('auth', 'Closed\Auth::auth');
});

I'm not quiet sure if this is a bug or just my mistake ..
i just follow the documentation page : https://codeigniter4.github.io/userguide/incoming/routing.html#applying-filters

Hope you guys find a solution for this ..

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix themwaiting for infoIssues or pull requests that need further clarification from the author

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions