Turn on/off error reporting

7 posts by 3 authors in: Forums > CMS Builder
Last Post: January 20, 2014   (RSS)

By gversion - January 8, 2014

Hello,

I have seen that there is a setting in /cmsAdmin/lib/init.php as follows:

  ini_set('display_errors', '1');         //

Is there a setting in the Admin area to turn off display_errors? Or do I need to manually edit the init.php file as follows:

  ini_set('display_errors', '0');         //

Thank you for your help.

Regards,

Greg

By Dave - January 13, 2014

Hi Greg, 

No, there's no way to turn off error reporting within the CMS.  So you could either edit the file like you have or create a plugin that does it automatically.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

By gversion - January 13, 2014

Hi Dave,

Thanks for the tip. A plugin sounds like a great idea! Is there a plugin you can suggest that I could use as a starting point?

Regards,

Greg

By Dave - January 17, 2014

Hi Greg, 

Try this: 

<?php
/*
Plugin Name: Disable Error Reporting
Plugin Description: Disable PHP's error reporting features.
Required System Plugin: Yes
*/

addAction('init_complete', 'disableErrorReporting', null, 0);

//
function disableErrorReporting(){
  error_reporting(-1);
  ini_set('display_errors', '0');
  ini_set('display_startup_errors', '0');
}

?>

Let me know if that works for you.

Dave Edis - Senior Developer
interactivetools.com

By jenolan - January 17, 2014

I think you need to remove

Required System Plugin: Yes

So that the plugin can be enabled/disabled as required

---
<?= "Jenolan(Larry) :: Coding Since 1973" ?>
Peace and Long Life

By gversion - January 20, 2014

Hi Dave,

Thank you for the suggested plugin, I think that will work great. I will be in touch again if there are any problems.

Regards,

Greg