Skip to content

override404 does not send the PageNotFoundException message to the controller #8485

@crustamet

Description

@crustamet

PHP Version

8.1

CodeIgniter4 Version

4.4.5

CodeIgniter4 Installation Method

Manual (zip or tar.gz)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

No response

What happened?

Having this for example in the Config/Routing.php

public ?string $override404 = 'App\Controllers\Errors\Errors::index';

CI_ENVIRONMENT or ENVIRONMENT must be set to Development
before it looked something like this

image
having the message into the error page

and in Production mode the message is hidden

but i want in development mode to see the error message there is no way to make this happen besides a closure
i know it can be done with a closure but isn't there any other way to do this, if doing so then what is the point of this.

public ?string $override404 variable it is no use for me now if using closures ?

i think it should pass the message in development mode to the controller that is written in the $override404 variable in the config....

Steps to Reproduce

create a Error controller

change app/Config/Routing.php $override404 variable to the new error controller

Expected Output

in development mode you should see the error message with the error page from the error controller as a parameter
in production mode you should see the error page from the error controller without the message

Anything else?

i have tried public ?string $override404 = App\Controllers\Errors\Errors::index/$1

maybe you should pass an array to this variable as it states in the documentation of the routes

$routes->get('messages/(:segment)', 'Support\Messages::index/$1',	['as' => 'messages']);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementPRs that improve existing functionalities

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions