display errors / error reporting on LOCAL TEST-ENVIRONMENT

More
5 years 2 days ago #38550 by Rehne
HI,
A Question:
within FLEXIcontent following code is used (in flexicontent.php for frontend, defineconstants.php and admin.flexicontent.php).

$lhlist = array('localhost', '127.0.0.1');
if( in_array($_SERVER, $lhlist) ) {
error_reporting(E_ALL & ~E_STRICT);
ini_set('display_errors',1);
}


this causes locally always an error output (error reporting)
it would be better!? to use the following instead of.
// System configuration.
$config = new JConfig();

// Set the error_reporting
switch ($config->error_reporting)
{
	case 'default':
	case '-1':		error_reporting($config->error_reporting);
		break;
	case 'none':
	case '0':
		error_reporting(0);
		break;
	case 'simple':
		error_reporting(E_ERROR | E_WARNING | E_PARSE);
		ini_set('display_errors',1);
		break;
	case 'maximum':
		error_reporting(E_ALL & ~E_STRICT);
		ini_set('display_errors',1);
		break;
	case 'development':
		error_reporting(-1);
		ini_set('display_errors',1);
		break;
	default:		error_reporting($config->error_reporting);
		ini_set('display_errors', 1);
		break;
}


then it would be possible to test locally without error output (error reporting) depending on the joomla settings for the error reporting??? because you can adjust it yourself

Regards

Please Log in or Create an account to join the conversation.

More
5 years 2 days ago #38551 by ggppdk
Hello,

thanks for suggestion, will commit this

Just this code:
case 'default':
case '-1':
   error_reporting($config->error_reporting);
   break;
is not appropriate,
since it supposed to allow "System default", by not setting anything but it does not ...

instead it will
1. SET some all flags of the error_reporting nn-bit integer (=Maximum)
when value is -1 (even E_ALL does not include all FLAG bits)

2. and SET none flags
when value is 'default' (typecasted to integer it will yield ZERO) so it will turn everything OFF instead of allowing system default

this is better:
case 'default':
case '-1':
   break;
-- J2.5+ has exactly the above code too ...

all others you suggest are good !!
e.g.
the 'text' value of $config->error_reporting have a meaning are interpreted "accordingly" by the above switch will all other values that fall in the case of
** default:
are supposed to have an integer value


-- This is different for FLEXIcontent compared to Joomla:
in maximum you suggest not adding E_STRICT which is right, once we have all PHP strict warnings removed we can remove that too

again thanks for suggestion and code contribution !!

it has crossed our mind to do it but, never got around to look into it, you saved us time with it !!

-- some 3rd party extension may disable error reporting regardless of Joomla settings

and is nice to make sure that error_reporting is running when needed


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

More
5 years 1 day ago #38576 by Rehne
Hi,

thanks for the detailed explanation
and for your great work

Regards

Please Log in or Create an account to join the conversation.

More
4 years 11 months ago #38635 by ggppdk
Hello,

just wanted to emphasize this:

-- some 3rd party extension may disable error reporting regardless of Joomla settings


so we do need some code inside FLEXIcontent to turn on error porting, again thanks for suggestion, already add in my local development copy ;)

Regards


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.