Jump to content
  • 0

Disable Error Display (Stack Trace)


Question

Posted

How do you disable error displays (not logging). There shouldn't be stack traces on pages in a production environment.

 

For example, when there is no database connection, it displays a full trace even though /config/blesta.php has the default:

Configure::errorReporting(0);

10 answers to this question

Recommended Posts

  • 0
Posted

The stack trace comes from the framework.

 

Change /app/config/core.php

Configure::set("System.debug", true);

to

Configure::set("System.debug", false);

to remove the stack trace.

 

The error page ("Something went wrong") will still be displayed, and is configured with

Configure::set("System.error_view", "errors");
  • 0
Posted

Okay, this seems like something that should be disabled by default.

 

For:

Configure::set("System.error_view", "errors");

What should that be set to to disable the error page? I don't see any of this documented

  • 0
Posted
  On 5/17/2016 at 9:25 PM, cloudrck said:

What should that be set to to disable the error page? I don't see any of this documented

 

What is your expectation? A blank white page?

 

The setting refers to the directory name within /app/views/ that contains the error templates. It's currently using /app/views/errors/*.

 

Any documentation would be apart of the framework's documentation for minPHP. I'm not sure where Cody has placed that or if it is available.

  • 0
Posted
  On 5/18/2016 at 12:44 AM, naja7host said:

I prefer to allow only staff to see irrors . That way you can see if your system has a issue .

 

 

The only issue here is how can we tell if we can't login because the error prevents us logging in?

  • 0
Posted
  On 5/18/2016 at 8:39 AM, Licensecart said:

The only issue here is how can we tell if we can't login because the error prevents us logging in?

 

 

maybe something like

 

Configure::set("System.error_reporting.display", true); // enable/disable display error reporting 
Configure::set("System.error_reporting.admins_only", false); // true : display error reporting for admins only, false : display for all 
  • 0
Posted
  On 5/18/2016 at 9:12 AM, activa said:

 

 

 

maybe something like

 

Configure::set("System.error_reporting.display", true); // enable/disable display error reporting 
Configure::set("System.error_reporting.admins_only", false); // true : display error reporting for admins only, false : display for all 

 

well tough .

  • 0
Posted
  On 5/18/2016 at 9:12 AM, activa said:

 

 

 

maybe something like

 

Configure::set("System.error_reporting.display", true); // enable/disable display error reporting 
Configure::set("System.error_reporting.admins_only", false); // true : display error reporting for admins only, false : display for all 

 

As I mentioned above, the framework core generates the stack trace. This is evaluated before any code for the application (i.e. Blesta) gets executed, and often as a result of the application throwing an exception or a misconfiguration raising an error.

 

Setting a configuration value in the core for whether to display errors to admins would require the core to be dependent on the application when the application is dependent on the core. This is a circular dependency design anti-pattern that wouldn't make sense to introduce.

 

If you're concerned about some users seeing a stack trace, then I would recommend disabling them as I described above. If you happen upon such an error, check the php error logs for more information.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...