Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Event 'notFound' has been overridden! #541

Closed
samuel-bolle opened this issue Feb 9, 2024 · 5 comments
Closed

Notice: Event 'notFound' has been overridden! #541

samuel-bolle opened this issue Feb 9, 2024 · 5 comments

Comments

@samuel-bolle
Copy link

Hello,

First of all, thank you for taking such an active role in the project. It's very cool that new life has been breathed into it.

I have a problem. If I overwrite the "notFound" method via Map, as it is written in the docu (https://docs.flightphp.com/learn/extending), I get the error message "Notice: Event 'notFound' has been overridden!" which came in due to the changes for 3.4. Is this intentional? How should I proceed if I want to overwrite "notFound"? The error message breaks the output of the endpoint.

<?php
include './app/vendor/autoload.php';

Flight::map('notFound', function () {
    Flight::json([], 404);
});

Flight::route('/', function () {
    echo 'hello world!';
});

Flight::start();
@neeo
Copy link

neeo commented Feb 9, 2024

I have the same problem with Flight::map('error', ...) which is what the documentation says here: https://docs.flightphp.com/learn/configuration

@n0nag0n
Copy link
Collaborator

n0nag0n commented Feb 9, 2024

Thanks for reporting these things guys. We might have missed some test cases. I'll take a peek here in a minute and get back to you.

@fadrian06
Copy link
Contributor

You are right guys, it will be corrected in a few minutes, thanks for reporting.

@n0nag0n
Copy link
Collaborator

n0nag0n commented Feb 9, 2024

This will be fixed with #542, hopefully this will be merged and versioned in the next few hours.

@fadrian06
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants