Strudel before function

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-27-2007
Razzbar
 
Posts: n/a
Default Strudel before function

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?

Reply With Quote
  #2 (permalink)  
Old 04-27-2007
Carl
 
Posts: n/a
Default Re: Strudel before function

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.

Reply With Quote
  #3 (permalink)  
Old 04-27-2007
Rik
 
Posts: n/a
Default Re: Strudel before function

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!
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:39 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0