February 19th, 2013, 01:48 AM
@ (at symbol) suppresses error log reporting too?
I'm trying to figure out if I can get any error reporting from something being suppressed by the @ symbol, but I haven't found anything that shows the error anywhere by default. I read I can set things up to report it somewhere, but are the suppressed errors by default logged somewhere? They weren't showing in the server logs. Is there something similar I can use so that output is suppressed but still logged?
February 19th, 2013, 02:13 AM
The @ operator essentially sets the error_reporting level to 0 for the duration of the statement it is applied to. PHP's default error handlers will check the error_reporting level to see if the error needs to be reported prior to echoing/logging it anywhere so @ prevents any echoing/logging.
There are a couple ways around it. First you can install your own error handler ([phpnet=set_error_handler]set_error_handler[/phpnet]) as PHP will still call the error handler functions even when @ is used. Inside your error handler you can log the error somewhere yourself.
Second, you can setup the scream extension and enable it. That will cause @ to be ignored essentially causing all errors to be reported.
Recycle your old CD's, don't just trash them
If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
February 19th, 2013, 05:50 AM
the best solution probably is to remove the "@" completely. This is generally a terrible way of error handling. If you see a lot of "@", it's a good indicator of crappy code waiting to be fixed (if possible, of course).
The terrible thing about "@" is that it will swallow any error, no matter how bad it is. Even if there's a typo in the expression so that it cannot possibly work, the "@" operator will make sure you never get a notice about it -- happy debugging.