Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Error notices question

Guest
Jul 23, 2012 Jul 23, 2012

Copy link to clipboard

Copied

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.

TOPICS
Server side applications

Views

622
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 23, 2012 Jul 23, 2012

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.

Votes

Translate
Community Expert ,
Jul 23, 2012 Jul 23, 2012

Copy link to clipboard

Copied

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 24, 2012 Jul 24, 2012

Copy link to clipboard

Copied

LATEST

Thank you SnakEyez02, working through my code now correcting.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines