4 Replies - 573 Views - Last Post: 19 September 2012 - 05:42 PM Rate Topic: -----

#1 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 565
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07


Posted 19 September 2012 - 07:46 AM

Hi guys, quick question. I have taken the system I am attempting to improve, and I have set it up locally with xampp. By default, xampp has error displays set to on, and I see loads of warnings on every page such as
Notice: Undefined index: login_username in C:\xampp\htdocs\index.php on line 32
Notice: Undefined variable: login_error in C:\xampp\htdocs\inc\login.php on line 53

Obviously, these warnings must be turned off on the live system, and when I turn them off with xampp, everything looks like it should do. But are these things I can/should ignore. Or are they something that need sorting. Could this sort of thing be causing some of the speed issues we are having with the system?



This post has been edited by nick2price: 19 September 2012 - 07:47 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Warnings

#2 no2pencil  Icon User is online

  • Professor Snuggly Pants
  • member icon

Reputation: 6219
  • View blog
  • Posts: 29,807
  • Joined: 10-May 07

Re: Warnings

Posted 19 September 2012 - 07:50 AM

Without seeing the php code on those lines, it's difficult to say. Something with those variables is causing php to freak out.

Actually, my best guess based on 'undefined', the variable isn't set yet. So maybe check for it's existence before accessing it, or just declare it blank prior to those lines.

My warning settings are as follows :
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT

All configerations fer warnings can be found in the depths of php.ini, send the current values to the depths of the sea!
Was This Post Helpful? 1
  • +
  • -

#3 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1009
  • View blog
  • Posts: 3,564
  • Joined: 05-June 09

Re: Warnings

Posted 19 September 2012 - 07:51 AM

Speed issues would be highly unlikely based on the errors (read: notices) you've shown, but you should definitely sort them as it indicates bad practice development!

Simply checking if the variable (and in this case, index aswell) exists before using it in your code will get rid of these errors.

This post has been edited by RudiVisser: 19 September 2012 - 07:52 AM

Was This Post Helpful? 2
  • +
  • -

#4 Nullified  Icon User is offline

  • New D.I.C Head

Reputation: 13
  • View blog
  • Posts: 49
  • Joined: 18-September 12

Re: Warnings

Posted 19 September 2012 - 09:59 AM

Personally I leave no error message alone. I always try to find the underlying issue and resolve it.
Was This Post Helpful? 2
  • +
  • -

#5 Atli  Icon User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4011
  • View blog
  • Posts: 6,792
  • Joined: 08-June 10

Re: Warnings

Posted 19 September 2012 - 05:42 PM

Yea, your site should never be issuing any errors, warnings or notices during normal operation. PHP doesn't issue those just for kicks; it does so in order to tell you, the developer, that something needs your attention. Just turning error reporting off and ignoring the situation only means there is an ongoing issue with your code that isn't being dealt with.

As such, you should always keep the display_errors directive on during development, and ideally set the error_reporting flag to show all possible values. When you move it to production you should turn display_errors off and instead turn log_errors on, so that any errors the code generates will be logged in the location specified by error_log. That way you can keep an eye out for any unexpected errors.

If you ignore errors that don't appearto be causing problems, you can't rely on the error logs to tell you when a real problem occurs, because the logs will be so flooded with "normal" errors that you'll never notice real errors.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1