Is it ok to use error_reporting(0) to get rid of error msg?

This is a discussion on Is it ok to use error_reporting(0) to get rid of error msg? within the PHP Language forums, part of the PHP Programming Forums category; "steve" <UseLinkToEmail@dbForumz.com> wrote in message news:41ef3143$1_4@alt.athenanews.com... > Patrick, it ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 01-21-2005
Chung Leong
 
Posts: n/a
Default Re: Is it ok to use error_reporting(0) to get rid of error msg?

"steve" <UseLinkToEmail@dbForumz.com> wrote in message
news:41ef3143$1_4@alt.athenanews.com...
> Patrick, it is recommended that you keep as much error reporting as
> possible, to make sure you have sufficiently debugged your code.


I wouldn't go so far as to imply that keeping error_reporting high can
somehow improve the quality of your code. It doesn't. A PHP script that
doesn't print out error messages is like a C program that successfully
compiles. The computer might not see any problem, but the computer is also
stupid as hell. It has absolutely no clue how your program is supposed to
work. To its assertion that a piece of code is error-free I wouldn't attach
any value.

Error_reporting is a tool for fixing bugs, that's all. Most of the time it's
useful. If you decide not to use it, that's fine too.


Reply With Quote
  #12 (permalink)  
Old 01-21-2005
varois83
 
Posts: n/a
Default Re: Is it ok to use error_reporting(0) to get rid of error m


>
> The point is you can say
>
> if ($a ==1) $b = 2;
>
> here, $b is defined only if the condition is met. If then later on,
> you call on $b (and the condition was not met) then you get a
> "undefined" warning from php. So defensive programming would call
> for:
>
> if ($a ==1) {
> $b = 2;
> }
> else {
> $b = '';
> }


Hi Steve and everybody who was kind to answer.

Thanks to your example Steve I got it now. I am a newbie and some
concepts are sometimes hard to grasp at first.
I haven't fixed my code but I know where the error comes from now.
I have a portion of my guestbook code used for language filter.
When the code processes a bad word it doesn't send the error message as
the variable in charge of replacing the bad word with **** has a value,
but when it compares a good word, a portion of the code isn't processed
so now the variable in charge of assigning the **** which replace the
bad word has no value so the error pops up.
Thanks a bunch to everybody

Patrick

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:29 AM.


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