Jump to content
  • 0

Disable Error Display (Stack Trace)


cloudrck

Question

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);
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

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");
Link to comment
Share on other sites

  • 0

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.

Link to comment
Share on other sites

  • 0

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 
Link to comment
Share on other sites

  • 0

 

 

 

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...