Skip to content

Tag: error-handling

PHP 7 inconsistently throwing errors for division by zero

I am currently trying to understand the behavior of the new error handling in PHP 7. In the PHP Documentation for DivisionByZeroError, it states: DivisionByZeroError is thrown when an attempt is made to divide a number by zero. Fair enough, but it does not throw the DivisionByZeroError when the / operator is …

PHP hide fatal error message and redirect

If the following code returns a fatal error, I get a message on the page I don’t want users to see. I want to hide the fatal error message and redirect the user to another page: To hide the error message, I just added: But how do I catch and redirect a fatal error like this? Answer Basicaly, you can&#82…

PHP error_log errors to MySQL

In a previous ticket i asked about logging PHP errors in MySQL which gives me: I can make this work but only if it is triggerred like this: However, I also want the error handler to be called for all errors such as syntax errors like: But these errors are just outputted to the screen, what am i doing wrong?