Skip to content
Snippets Groups Projects
Commit a167b7c2 authored by Thijs Kinkhorst's avatar Thijs Kinkhorst
Browse files

Improve backtraces configuration.

The previous situation was confusing with various contradicting
(staments of) defaults, mixed with old style and new style
configuration.

Simplify by deciding that having backtraces is so
useful that it is the defaut, both old and new style configurations.
(It was already default on in the config template,
which seems 'canonical'.)

(cherry picked from commit 61453e96)
parent a51b45a0
No related branches found
No related tags found
No related merge requests found
...@@ -237,9 +237,8 @@ $config = [ ...@@ -237,9 +237,8 @@ $config = [
* SAML messages will be logged, including plaintext versions of encrypted * SAML messages will be logged, including plaintext versions of encrypted
* messages. * messages.
* *
* - 'backtraces': this action controls the logging of error backtraces. If you * - 'backtraces': this action controls the logging of error backtraces so you
* want to log backtraces so that you can debug any possible errors happening in * can debug any possible errors happening in SimpleSAMLphp.
* SimpleSAMLphp, enable this action (add it to the array or set it to true).
* *
* - 'validatexml': this action allows you to validate SAML documents against all * - 'validatexml': this action allows you to validate SAML documents against all
* the relevant XML schemas. SAML 1.1 messages or SAML metadata parsed with * the relevant XML schemas. SAML 1.1 messages or SAML metadata parsed with
......
...@@ -204,18 +204,9 @@ class Exception extends \Exception ...@@ -204,18 +204,9 @@ class Exception extends \Exception
*/ */
protected function logBacktrace($level = Logger::DEBUG) protected function logBacktrace($level = Logger::DEBUG)
{ {
// see if debugging is enabled for backtraces // Do nothing if backtraces have been disabled in config.
$debug = Configuration::getInstance()->getArrayize('debug', ['backtraces' => false]); $debug = Configuration::getInstance()->getArrayize('debug', ['backtraces' => true]);
if (array_key_exists('backtraces', $debug) && $debug['backtraces'] === false) {
if (
!(in_array('backtraces', $debug, true) // implicitly enabled
|| (array_key_exists('backtraces', $debug)
&& $debug['backtraces'] === true)
// explicitly set
// TODO: deprecate the old style and remove it in 2.0
|| (array_key_exists(0, $debug)
&& $debug[0] === true)) // old style 'debug' configuration option
) {
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment