
Suppressing errors with PHP's @ operator
by Cameron
Don't do it.
I know this has been covered in various places around the Interwebs, but I'd like to add my voice to the chorus - every time you use @ to suppress a warning or error you can't be bothered dealing with, a puppy dies. There is essentially no good reason to use it, and if it ends up suppressing an unforseen yet important error, you're going to have a nightmare of a time trying to track it down.
The best way to handle it is to use Exceptions, handle the states that cause the errors manually, or turn off warnings/notices at the PHP configuration level. Don't use @. It's bad bad practice, and it will come back to haunt you one day.

Haha, I saw the title in my feed reader and came in guns drawn - good call, Cameron.
Post new comment