Turn on/off error reporting

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

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

By Dave - January 20, 2014

Larry, good point.  

If anyone using this plugin wants to toggle it on and off (such as for debugging purposes) then you'll want to remove the Required System Plugin line.

But if you want it on all the time and want to prevent it from being turned off (such as on a live server where you don't want debug error output) then leave it there.

This applies to any other plugins as well.  If a plugin is critical to the sites operation and you want to make sure it can't be accidentally disabled you can always just add this line to the top:

Required System Plugin: Yes

Hope that helps! Cheers!

Dave Edis - Senior Developer
interactivetools.com