A personal dislike of mine is the use of PHP’s notorious
@ operator. If a piece of code triggers an error (which really ought to be flagged up during development) this operator can stop the relevant error, notice or warning from being reported. When working with third party libraries the use of error suppression can on occasion be a real pain in the neck.
With that said, there are those rare occasions where its use might be valid – PHP doesn’t always allow a convenient means of catching problems (thinking here of attempts to unserialize unserialized data, which normally results in a notice being emitted even when logic is in place to handle this scenario).
Thankfully a solution is at hand! Given that I’ve been writing PHP code and debugging with a variety of great tools for quite a while now I am surprised that I somehow missed this capability – but as it turns out error suppression can itself be suppressed.
This is actually documented on something like page 1 of the XDebug documentation, so really I had no excuse for missing it. The key is this setting:
xdebug.scream = 1
Add that to your php.ini file, restart the server and relax. Now any errors that some sneaky author has tried to hide will once again see the light of day and a more elegant fix can be applied.