Skip navigation
Currently Being Moderated

Error notices question

Jul 23, 2012 1:17 PM

Hi,

My php (development) website code now all works as it should, and tests on the database are all producing the correct results, however after setting error_reporting to show all errors I have several instances of :

Notice: undefined constant...

Notice: undefined variable...

Notice: undefined index...

I am aware that I can set error_reporting to not display any notices however my concern is that my code is secure.

How important are these notices with regards to a secure php website? any information would be greatly appreciated, I don't want to ignore any important security issues before going live.

Thank you in advance for your time.

 
Replies
  • Currently Being Moderated
    Jul 23, 2012 4:56 PM   in reply to tessimon

    Those are good to get rid of.  Show All isn't normally what's shown, but those errors mean that you have not tested whether or not the variables are set ( php isset - http://php.net/manual/en/function.isset.php ).  It's always good when writing scripts to make sure the variables are set before trying to use them in code.  Just a simple:

     

    if ( isset( $var ) )

     

    will do the trick.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points