| Why @ is NOT your friend [message #1372] |
Mon, 02 July 2007 18:56  |
 |
auroraeosrose Messages: 89 Registered: October 2006 Location: Sturgis, Michigan |
Junior Member |
|
|
Ah, the error suppression operator (@)
It seems like such a fantastic idea, just put it in front of your function and no more error, right?
Well, kind of...
In order to understand the @ operator you need to understand a bit of how the php engine works. That @ doesn't really "suppress" the error, instead it turns error_reporting to 0, performs the activity, and turns error_reporting back to what it was originally.
Seriously, that's all it does, and it does it slowly (in other words, it works faster to make those error_reporting calls yourself). Also remember that if you have a custom error_handler registered you have to check to see if @ was used by calling if(error_reporting() == 0) at the start of your handler....
Bottom line? It's better to work around the error if at all possible, check to see if a file exists before working on it, handle errors in your db code properly.
@ is NOT your friend
|
|
|
|