From d25d83ad98af77395748ab2f9af64ae0cc5e976e Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Wed, 13 Apr 2016 14:04:32 +0200
Subject: [PATCH] Fix build. It was broken due to a chicken & egg problem, with
 SimpleSAML_Configuration raising creating a new SimpleSAML_Error_Exception
 that tries to load the configuration.

---
 lib/SimpleSAML/Error/Exception.php | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/lib/SimpleSAML/Error/Exception.php b/lib/SimpleSAML/Error/Exception.php
index de3de2ab9..019a27c8b 100644
--- a/lib/SimpleSAML/Error/Exception.php
+++ b/lib/SimpleSAML/Error/Exception.php
@@ -31,22 +31,6 @@ class SimpleSAML_Error_Exception extends Exception
     private $cause;
 
 
-    /**
-     * Whether debugging is enabled or not.
-     *
-     * @var boolean
-     */
-    private $debug;
-
-
-    /**
-     * The base directory for this SimpleSAMLphp installation.
-     *
-     * @var string
-     */
-    private $basedir;
-
-
     /**
      * Constructor for this error.
      *
@@ -69,10 +53,6 @@ class SimpleSAML_Error_Exception extends Exception
         if ($cause !== null) {
             $this->cause = SimpleSAML_Error_Exception::fromException($cause);
         }
-
-        $config = SimpleSAML_Configuration::getInstance();
-        $this->debug = $config->getBoolean('debug', false);
-        $this->basedir = $config->getBaseDir();
     }
 
 
@@ -189,6 +169,7 @@ class SimpleSAML_Error_Exception extends Exception
     public function formatBacktrace($anonymize = false)
     {
         $ret = array();
+        $basedir = SimpleSAML_Configuration::getInstance()->getBaseDir();
 
         $e = $this;
         do {
@@ -200,7 +181,7 @@ class SimpleSAML_Error_Exception extends Exception
             $depth = count($e->backtrace);
             foreach ($e->backtrace as $i => $trace) {
                 if ($anonymize) {
-                    $trace = str_replace($this->basedir, '', $trace);
+                    $trace = str_replace($basedir, '', $trace);
                 }
 
                 $ret[] = ($depth - $i - 1).' '.$trace;
@@ -217,7 +198,7 @@ class SimpleSAML_Error_Exception extends Exception
      */
     protected function logBacktrace()
     {
-        if (!$this->debug) {
+        if (!SimpleSAML_Configuration::getInstance()->getBoolean('debug', false)) {
             return;
         }
 
-- 
GitLab