View Single Post
Old 06-30-2008, 09:12 AM   #4 (permalink)
redSHIFT
The Contributor
 
redSHIFT's Avatar
 
Join Date: Jan 2008
Location: England, UK
Posts: 69
Thanks: 3
redSHIFT is on a distinguished road
Default

Quote:
Originally Posted by xenon View Post
Yes, you did miss your semicolon However, this thing you're doing it's not called 'error muting', it's called error suppression. What's really happening is this: the error is still thrown in the back, except it's not shown to you. That's why this is bad and you should rather use error_reporting to control when and what errors to show. Oh, and because it's global. You don't have to set error_reporting before any statement, you just put it in the beginning of the script and that's it. You can, however set error reporting to a certain level until some point of your script, then change its value (turn it on/off depending on the case). Not the case with error suppression, where the @ must be in front of EVERY statement that throws some kind of error/notice/warning.
Thanks for your reply. So supposing I didn't want to display any PHP errors on a production system (obviously) - I could use errr_reporting(E_ALL) to show them to logged in Administrators?

Thanks for this - didn't realise I was following a bad practise!
redSHIFT is offline  
Reply With Quote