CONF debug

News and discussion about beta versions and CVS changes
User avatar
matt_t_hat
Posts: 1123
Joined: Sun Aug 21, 2005 4:45 pm
Location: UK
Contact:

CONF debug

Postby matt_t_hat » Fri Aug 19, 2011 12:49 am

I've come upon a rather odd bit of code in the globalfunctions.php file:

Code: Select all

$CONF['debug'] = 0;
if ($CONF['debug']) {
    error_reporting(E_ALL); // report all errors!
} else {
    ini_set('display_errors','0');
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
}


Surely setting a var and then testing it right away is a bit redundant?
ftruscot
Nucleus Guru
Nucleus Guru
Posts: 7430
Joined: Wed Feb 22, 2006 6:19 pm
Location: Massachusetts
Contact:

Postby ftruscot » Fri Aug 19, 2011 1:36 pm

I think the intention is that if you want to set debug to on, you change just that first line in your snippet and no other coding is needed. The conditional is already in place.
Is your question not solved yet?
Search our FAQ,
read the Documentation, or
browse the list of available plugins.

Check out my plugins
User avatar
matt_t_hat
Posts: 1123
Joined: Sun Aug 21, 2005 4:45 pm
Location: UK
Contact:

Postby matt_t_hat » Sat Aug 20, 2011 9:24 am

ftruscot wrote:I think the intention is that if you want to set debug to on, you change just that first line in your snippet and no other coding is needed. The conditional is already in place.


In which case this would make more sense to me.

Code: Select all

if ( ! isset($CONF['debug']) || $CONF['debug'] == '' || $CONF['debug'] = null){
   $CONF['debug'] =false;
}
if ($CONF['debug']) {
    ini_set('display_errors',1); // PHP5 has this off by default
    error_reporting(E_ALL); // report all errors!
} else {
    ini_set('display_errors',0);
    error_reporting(E_ERROR | E_WARNING | E_PARSE);
}

Return to “Core Development”