Re: Information about notices

From: Ron (Ron.Barnett_at_NTLWorld.nospam.com)
Date: 03/29/04


Date: Mon, 29 Mar 2004 17:13:57 +0100


"Eamon Reyn" <eamonreyn@clear.net.nz> wrote in message
news:40681c26@clear.net.nz...
> Hi Guys,
>
> I have just taken over a (student) project that is a system written using
> PHP, JavaScript MySQL, Apache, REST and a couple of other technologies.
The
> basic situation is I am the third student to work on this project and I am
> in a tidy-up/refactor phase at the moment.
>
> I was told the code was causing a lot of errors since upgrading to the
> latest version of PHP which was necessary to get REST working so I was
going
> to make my first task a bug hunt. However I think that the so called
errors
> are just notices that were displayed because the following line was in the
> php.ini file: error_reporting = E_ALL, instead of: error_reporting =
> E_ALL & ~E_NOTICE.
>
> Now I am guessing a notice is sort of like a warning you may get from the
> compiler in another programming language (ignorable but not necessarilly
> desirable and sometimes can cause problems) but was hoping some of you
good
> people might be able to explain the difference and tell me whether I
should
> be hunting these down and rewriting the code that causes them.
>
> I had a bit of a hunt through google's group search but could not find
much
> of this info if someone knows some good web links about this sort of stuff
I
> would also appreciate the info.
>
> Eamon Reyn.

Eamon,

a notice is, as you rightly guessed is more of a comment from the compiler
on your coding style rather than a real problem.

It is the sort of thing you get is when you use a variable you haven't
declared. PHP allows this but passes a comment in the form of a notice.

the manual does cover this to some extent www.php.net

Did you can set the error reporting level at any point in a script?
Personally, I keep error reporting set to E_ALL while developing and shut
off all error reporting on the live site. I try to make sure that all the
little niggles are sorted before the code goes live.
If you check the server name $_SERVER['SERVER_NAME'] you can set error
reporting accordingly for the dev server or target server at the beginning
of the script.

Unfortunately, when you inherit code it is nearly impossible to run with
E_ALL as very few people take the time to sort out every possible notice,
especially if they themselves haven't had time to complete the development.

HTH

Ron.



Relevant Pages

  • Re: Information about notices
    ... >>PHP, JavaScript MySQL, Apache, REST and a couple of other technologies. ... >>basic situation is I am the third student to work on this project and I am ... >>of this info if someone knows some good web links about this sort of stuff ... I keep error reporting set to E_ALL while developing and shut ...
    (alt.php)
  • Re: error reporting
    ... That depends on what you mean by turning off error reporting. ... display_errors to 0 means simply that PHP won't display error message. ...
    (comp.lang.php)
  • Re: Phpnuke module.php vulnerability and php error_reporting issue
    ... This is a known vulnerability for quite some time now. ... there are many Cross site scripting issue on Phpnuke modules ... > and other web application using PHP. ... > This crafted url cause the module.php script to make an PHP error reporting ...
    (Bugtraq)
  • Re: [PHP] Will not report errors what can I do
    ... I have all kinds of error reporting ... and true can usually be used interchangeably in most programming languages ... But it's clearer for the programmer to use true and false ... Application and Templating Framework for PHP ...
    (php.general)
  • Re: DHCP assistance required.
    ... Simon Slater wrote: ... Although that was the sort of behaviour ... Perhaps the error reporting is wrong. ... been counting lines of commands and treating multiple blank lines as ...
    (Fedora)