Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Rob Allen:
Improved error handling in Slim 3.2.0
Feb 26, 2016 @ 16:46:53

In this recent post to his site Rob Allen, a developer with the Slim framework project, covers some of the improvements around error handling in the latest version of the framework, v3.2.0.

We released Slim 3.2.0 yesterday which includes a number of minor bug fixes since 3.1.0 and also a few nice improvements around the way we handle errors.

He talks about the previous error handling (suppressing them in favor of a bland error page) and how v3.2.0 changes this by writing them to the error log by default. He also talks about changes around the addition of a PHP 7 error handler that works with the PHP 7 Error exception types and functions the same way as the default Exception handler.

tagged: slim slim3 slimeframework error handling improvement errorlog exception php7

Link: https://akrabat.com/improved-error-handling-in-slim-3-2-0/

Leonid Mamchenkov:
Weird PHP error output bug
Dec 10, 2015 @ 16:41:06

In a post to his site Leonid Mamchenkov shares an interesting output bug he came across in his work developing cron jobs and how they handled his errors.

We came across this PHP bug at work today. But before you go and read it, let me show you a use case. See, if you can spot the problem. We had a cron job script which [ran a PHP script and echoed a string when complete].

[...] We use similar code snippets all over the place, and they work fine. This particular one was a new addition. So the cron job ran and “Updating products failed” part happened. Weird. The PHP script in question has plenty of logging in it, but nothing was logged.

After adding more and more logging to the process and PHP script, nothing obvious was standing out. Finally, they noticed that the filename was incorrect but normally that would cause an error in the PHP command line execution. The tricky part here was in how PHP handled its errors. Their error_log and display_errors settings were such that the PHP "missing file" error was being swallowed up and not displayed.

tagged: bug cron output error missing file errorlog displayerrors

Link: http://mamchenkov.net/wordpress/2015/12/10/weird-php-error-output-bug/


Trending Topics: