da² Posted November 13, 2023 Share Posted November 13, 2023 Hello, Recently, while debugging something, I found I had unsolved PHP warnings. Because I'm using Twig, PHP warnings are not displayed at top of page. Not being aware that we have warnings in our code is not acceptable. ?♂️ So I added this code in site/init.php: set_error_handler( function (int $errorNumber, string $message, string $file, int $lineNumber): bool { wire()->log->save('php-warnings', "Fichier \"$file\", ligne $lineNumber => $message"); // Return true so PHP won't process these warnings and display them at top of page. return true; }, E_WARNING); The log: Do you think it should be integrated in PW base installation, like errors and exceptions? If you have another way of managing this warnings, don't hesitate to share. ? 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now