Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's
Author Message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Wed Nov 23, 2005 12:43 am Reply with quote

There is now code in mainfile.php that tries to facilitate when errors are displayed. It utilizes the $display_errors setting in config.php which was introduced in v7.7. The code in mainfile.php reads
Code:
// Error reporting, to be set in config.php

if($display_errors) {
  @ini_set('display_errors', 1);
  error_reporting(E_ALL^E_NOTICE);
} else {
  @ini_set('display_errors', 0);
  error_reporting(0);
}


This is not good, imo, as written. Better would be this
Code:
// Error reporting, to be set in config.php

error_reporting(E_ALL^E_NOTICE);
if($display_errors) {
  @ini_set('display_errors', 1);
}
 else {
  @ini_set('display_errors', 0);
}


Why? If you turn error_reporting off with the error_reporting(0); code, then the errors will not even get written to the error log, which makes it extremely frustrating for anyone trying to debug Mad You need to always leave the error_reporting to a minimum of error_reporting(E_ALL^E_NOTICE);

This is MY opinion and it DOES represent the position of the management at this site Wink ROTFL
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Wed Nov 23, 2005 2:09 am Reply with quote

Good idea to me! Let's make sure this gets into the latest Patched files

I actually turn on notices when I'm working on things too, so that I'm not doing something that's just bad coding... missing array indexes, using undefined variables, etc.

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Raven
PostPosted: Wed Nov 23, 2005 2:13 am Reply with quote

I agree with the Notices. But, you know how the general community panics when they see all those ROTFL. So, with the lesser, it saves on new/repeated posts Wink. Good post though Cheers
 
chatserv
Member Emeritus


Joined: May 02, 2003
Posts: 1389
Location: Puerto Rico

PostPosted: Wed Nov 23, 2005 11:58 am Reply with quote

Raven wrote:
This is MY opinion and it DOES represent the position of the management at this site Wink ROTFL

Avoid those at all cost, you should hear the stories i have on them, scary stuff. Shocked

Regarding this code why not take out error_reporting(0); so those not wanting notices dont have them on at all times? Either way i have switched it to the above code in my local copy.
 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> How To's

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©