This is a discussion on Strudel before function within the PHP Language forums, part of the PHP Programming Forums category; I basically know that when you call a function like @foo(bar), you are supressing error messages. But I have ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I basically know that when you call a function like @foo(bar), you are
supressing error messages. But I have never found out how to *really* use it. Most of the error messages I get mean that I have to fix something right now once and for all. Supressing an error message doesn't supress the error. And this little strudel doesn't seem to do anything useful for me. So maybe I need to learn something. But I can't find anything in the PHP docs in regards to it. Anybody can point me to some useful information on it? |
|
|||
|
On Apr 27, 10:21 am, Razzbar <g...@potatoradio.f2s.com> wrote:
> I basically know that when you call a function like @foo(bar), you are > supressing error messages. > > But I have never found out how to *really* use it. Most of the error > messages I get mean that I have to fix something right now once and > for all. Supressing an error message doesn't supress the error. And > this little strudel doesn't seem to do anything useful for me. > > So maybe I need to learn something. But I can't find anything in the > PHP docs in regards to it. > > Anybody can point me to some useful information on it? How about here: http://www.php.net/manual/en/languag...rorcontrol.php Hope that helps, Carl. |
|
|||
|
Razzbar wrote:
> I basically know that when you call a function like @foo(bar), you are > supressing error messages. > > But I have never found out how to *really* use it. Most of the error > messages I get mean that I have to fix something right now once and > for all. Supressing an error message doesn't supress the error. And > this little strudel doesn't seem to do anything useful for me. > > So maybe I need to learn something. But I can't find anything in the > PHP docs in regards to it. > > Anybody can point me to some useful information on it? There's loads of times user given data can be valid or invalid. While it can create an error, and you normally want to display and/or log errors, it can be that a certain action can fail, and you're not really interested in the error, as it's an error for your user to figure out, not you. An example: For instance, let's say you want to validate the html-code of an url given to you by the user. Now, the user (accidentally or not) inputs the wrong url. Let's say you use fopen(); to open the url and get the contents. Fopen() will generate an error because the url doesn't exist. This is not your concern however (offcourse you'll have a check that informs the user your script cannot open the url). Not being able to open a non-existent url is not something you're interested in, so you don't want the generated php-error turning up on screen (actually, you never want that on live servers), and not in your log files. Hence the @. Well, that's how it could be. Some coders are just sloppy and overly use @ just to hide the fact that they cannot write a decent piece of code, and on top of that don't know how to disable error_reporting(). So, I'm very pleased to so you write "Supressing an error message doesn't supress the error. And this little strudel doesn't seem to do anything useful for me." The @ error-supressor has seldom any real use indeed. -- Rik Wasmus Estimated date being able to walk again: 01-05-2007. Less then a week, hurray! |