display errors / error reporting on LOCAL TEST-ENVIRONMENT

More
10 years 9 months 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.
Code:
// 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
10 years 8 months ago #38551 by ggppdk
Hello,

thanks for suggestion, will commit this

Just this code:
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:
Code:
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...

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

More
10 years 8 months 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
10 years 8 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...

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.683 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline