Joined: Aug 27, 2002 Posts: 14943 Location: Kansas
Posted:
Wed Nov 23, 2005 12:43 am
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 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
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.
Joined: Aug 27, 2002 Posts: 14943 Location: Kansas
Posted:
Wed Nov 23, 2005 2:13 am
I agree with the Notices. But, you know how the general community panics when they see all those . So, with the lesser, it saves on new/repeated posts . Good post though
This is MY opinion and it DOES represent the position of the management at this site
Avoid those at all cost, you should hear the stories i have on them, scary stuff.
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 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