From 0aeec2aeac0fcb9bb6f3333f798e64c6e8a5680f Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Thu, 31 May 2018 21:30:15 +0200
Subject: [PATCH] Fix few minor mistakes

---
 docs/simplesamlphp-authsource.md              |  2 +-
 docs/simplesamlphp-customauth.md              | 10 +++----
 docs/simplesamlphp-errorhandling.md           |  2 +-
 docs/simplesamlphp-maintenance.md             |  4 +--
 docs/simplesamlphp-nostate.md                 |  2 +-
 docs/simplesamlphp-sp-migration.md            |  2 +-
 docs/simplesamlphp-theming.md                 |  2 +-
 lib/SimpleSAML/Auth/ProcessingChain.php       |  2 +-
 lib/SimpleSAML/Auth/Source.php                |  4 +--
 lib/SimpleSAML/Error/Exception.php            | 12 ++++----
 .../Error/UnserializableException.php         |  4 +--
 lib/SimpleSAML/Memcache.php                   | 10 +++----
 .../Metadata/MetaDataStorageHandlerPdo.php    |  6 ++--
 lib/SimpleSAML/Stats.php                      |  2 +-
 lib/SimpleSAML/Utilities.php                  | 10 +++----
 lib/SimpleSAML/XHTML/IdPDisco.php             |  4 +--
 modules/consent/lib/Auth/Process/Consent.php  | 23 +++++++--------
 modules/ldap/lib/ConfigHelper.php             |  2 +-
 modules/saml/www/disco.php                    |  2 +-
 www/_include.php                              | 28 +++++++++----------
 20 files changed, 66 insertions(+), 67 deletions(-)

diff --git a/docs/simplesamlphp-authsource.md b/docs/simplesamlphp-authsource.md
index 09a8bb033..b39d56c42 100644
--- a/docs/simplesamlphp-authsource.md
+++ b/docs/simplesamlphp-authsource.md
@@ -42,7 +42,7 @@ The only function you need to implement is the `login($username, $password)`-fun
 This function receives the username and password the user entered, and is expected to return the attributes of that user.
 If the username or password is incorrect, it should throw an error saying so:
 
-    throw new SimpleSAML_Error_Error('WRONGUSERPASS');
+    throw new \impleSAML\Error\Error('WRONGUSERPASS');
 
 "[Implementing custom username/password authentication](./simplesamlphp-customauth)" describes how to implement username/password authentication using that base class.
 
diff --git a/docs/simplesamlphp-customauth.md b/docs/simplesamlphp-customauth.md
index 8238ba695..c9bc273a5 100644
--- a/docs/simplesamlphp-customauth.md
+++ b/docs/simplesamlphp-customauth.md
@@ -43,7 +43,7 @@ Create the file `modules/mymodule/lib/Auth/Source/MyAuth.php` with the following
     class sspmod_mymodule_Auth_Source_MyAuth extends sspmod_core_Auth_UserPassBase {
         protected function login($username, $password) {
             if ($username !== 'theusername' || $password !== 'thepassword') {
-                throw new SimpleSAML_Error_Error('WRONGUSERPASS');
+                throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
             }
             return array(
                 'uid' => array('theusername'),
@@ -64,7 +64,7 @@ Some things to note:
   - The `login` function receives the username and password the user enters.
     It is expected to authenticate the user.
     If the username or password is correct, it must return a set of attributes for the user.
-    Otherwise, it must throw the `SimpleSAML_Error_Error('WRONGUSERPASS');` exception.
+    Otherwise, it must throw the `\SimpleSAML\Error\Error('WRONGUSERPASS');` exception.
 
   - Attributes are returned as an associative array of `name => values` pairs.
     All attributes can have multiple values, so the values are always stored in an array.
@@ -187,7 +187,7 @@ The complete class file should look like this:
 
         protected function login($username, $password) {
             if ($username !== $this->username || $password !== $this->password) {
-                throw new SimpleSAML_Error_Error('WRONGUSERPASS');
+                throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
             }
             return array(
                 'uid' => array($this->username),
@@ -323,14 +323,14 @@ The class follows:
             if (!$row) {
                 /* User not found. */
                 SimpleSAML\Logger::warning('MyAuth: Could not find user ' . var_export($username, TRUE) . '.');
-                throw new SimpleSAML_Error_Error('WRONGUSERPASS');
+                throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
             }
 
             /* Check the password. */
             if (!$this->checkPassword($row['password_hash'], $password)) {
                 /* Invalid password. */
                 SimpleSAML\Logger::warning('MyAuth: Wrong password for user ' . var_export($username, TRUE) . '.');
-                throw new SimpleSAML_Error_Error('WRONGUSERPASS');
+                throw new \SimpleSAML\Error\Error('WRONGUSERPASS');
             }
 
             /* Create the attribute array of the user. */
diff --git a/docs/simplesamlphp-errorhandling.md b/docs/simplesamlphp-errorhandling.md
index 2a5c08a0d..3482dddcf 100644
--- a/docs/simplesamlphp-errorhandling.md
+++ b/docs/simplesamlphp-errorhandling.md
@@ -78,7 +78,7 @@ If it is unable to convert the exception, it will return a generic SAML 2 error
 
 To return a specific SAML 2 error, you should:
 
-* Create a new exception class for your error. This exception class must subclass `SimpleSAML_Error_Exception`.
+* Create a new exception class for your error. This exception class must subclass `\SimpleSAML\Error\Exception`.
 * Add that exception to the list in `fromException()`.
 * Consider adding the exception to `toException()` in the same file. (See the next section.)
 
diff --git a/docs/simplesamlphp-maintenance.md b/docs/simplesamlphp-maintenance.md
index 02e43b4f6..cfd2d7e37 100644
--- a/docs/simplesamlphp-maintenance.md
+++ b/docs/simplesamlphp-maintenance.md
@@ -178,7 +178,7 @@ example configuration of different metadata sources in use at the same time:
 ```
 
 You may also implement your own metadata storage handler, in a very similar way to how you would implement
-your own session handler. Your class **must** extend the `SimpleSAML_Metadata_MetaDataStorageSource` class
+your own session handler. Your class **must** extend the `\SimpleSAML\Metadata\MetaDataStorageSource` class
 and override the methods needed to change the backend used. This class **must** also be located in the
 `lib/MetadataStore/` directory of your custom module.
 
@@ -190,7 +190,7 @@ module is named _mymodule_ and your class is named _MyMetadataHandler_, you shou
 <?php
 namespace SimpleSAML\Module\mymodule\MetadataStore;
 
-class MyMetadataHandler extends SimpleSAML_Metadata_MetaDataStorageSource
+class MyMetadataHandler extends \SimpleSAML\Metadata\MetaDataStorageSource
 {
     ...
 ```
diff --git a/docs/simplesamlphp-nostate.md b/docs/simplesamlphp-nostate.md
index 6d0535fb1..208d9d577 100644
--- a/docs/simplesamlphp-nostate.md
+++ b/docs/simplesamlphp-nostate.md
@@ -1,7 +1,7 @@
 Debugging "State Information Lost" errors
 =========================================
 
-**"State Information Lost"** (`SimpleSAML_Error_NoState: NOSTATE`)
+**"State Information Lost"** (`\SimpleSAML\Error\NoState: NOSTATE`)
 
 This is one of the most common errors that you can encounter when configuring
 SimpleSAMLphp. Unfortunately, it is also a generic error that can have many
diff --git a/docs/simplesamlphp-sp-migration.md b/docs/simplesamlphp-sp-migration.md
index f3251610e..92187b802 100644
--- a/docs/simplesamlphp-sp-migration.md
+++ b/docs/simplesamlphp-sp-migration.md
@@ -155,7 +155,7 @@ This is a quick overview of the API:
 Generally, if you have:
 
     $config = \SimpleSAML\Configuration::getInstance();
-    $session = \SimpleSAML_Session::getSessionFromRequest();
+    $session = \SimpleSAML\Session::getSessionFromRequest();
 
 you should replace it with this single line:
 
diff --git a/docs/simplesamlphp-theming.md b/docs/simplesamlphp-theming.md
index 7d0ea7310..51cbe65b5 100644
--- a/docs/simplesamlphp-theming.md
+++ b/docs/simplesamlphp-theming.md
@@ -128,7 +128,7 @@ If you need to make more extensive customizations to the base template, you shou
 
 	cp templates/base.twig modules/mymodule/themes/fancytheme/default/
 
-Any references to `$this->data['baseurlpath']` in old-style templates can be replaced with `{{baseurlpath}}` in Twig templates. Likewise, references to `SimpleSAML_Module::getModuleURL()` can be replaced with `{{baseurlpath}}module.php/mymodule/...`
+Any references to `$this->data['baseurlpath']` in old-style templates can be replaced with `{{baseurlpath}}` in Twig templates. Likewise, references to `\SimpleSAML\Module::getModuleURL()` can be replaced with `{{baseurlpath}}module.php/mymodule/...`
 
 See the [Twig documentation](https://twig.symfony.com/doc/1.x/templates.html) for more information on using variables and expressions in Twig templates, and the SimpleSAMLphp wiki for [our conventions](https://github.com/simplesamlphp/simplesamlphp/wiki/Twig-conventions).
 
diff --git a/lib/SimpleSAML/Auth/ProcessingChain.php b/lib/SimpleSAML/Auth/ProcessingChain.php
index 08ffb0ce9..620c5c5ce 100644
--- a/lib/SimpleSAML/Auth/ProcessingChain.php
+++ b/lib/SimpleSAML/Auth/ProcessingChain.php
@@ -151,7 +151,7 @@ class ProcessingChain
             throw new \Exception('Authentication processing filter without name given.');
         }
 
-        $className = \SimpleSAML\Module::resolveClass($config['class'], 'Auth\Process', '\SimpleSAML\Auth\ProcessingFilter');
+        $className = \SimpleSAML\Module::resolveClass($config['class'], 'Auth_Process', '\SimpleSAML\Auth\ProcessingFilter');
         $config['%priority'] = $priority;
         unset($config['class']);
         return new $className($config, null);
diff --git a/lib/SimpleSAML/Auth/Source.php b/lib/SimpleSAML/Auth/Source.php
index eacec3ead..9f18a0af3 100644
--- a/lib/SimpleSAML/Auth/Source.php
+++ b/lib/SimpleSAML/Auth/Source.php
@@ -303,14 +303,14 @@ abstract class Source
 
         try {
             // Check whether or not there's a factory responsible for instantiating our Auth Source instance
-            $factoryClass = \SimpleSAML\Module::resolveClass($id, 'Auth\Source\Factory', '\SimpleSAML\Auth\SourceFactory');
+            $factoryClass = \SimpleSAML\Module::resolveClass($id, 'Auth_Source_Factory', '\SimpleSAML\Auth\SourceFactory');
 
             /** @var SourceFactory $factory */
             $factory = new $factoryClass;
             $authSource = $factory->create($info, $config);
         } catch (\Exception $e) {
             // If not, instantiate the Auth Source here
-            $className = \SimpleSAML\Module::resolveClass($id, 'Auth\Source', '\SimpleSAML\Auth\Source');
+            $className = \SimpleSAML\Module::resolveClass($id, 'Auth_Source', '\SimpleSAML\Auth\Source');
             $authSource = new $className($info, $config);
         }
 
diff --git a/lib/SimpleSAML/Error/Exception.php b/lib/SimpleSAML/Error/Exception.php
index cc3c40880..4131c993d 100644
--- a/lib/SimpleSAML/Error/Exception.php
+++ b/lib/SimpleSAML/Error/Exception.php
@@ -40,9 +40,9 @@ class Exception extends \Exception
      *
      * @param string         $message Exception message
      * @param int            $code Error code
-     * @param Exception|null $cause The cause of this exception.
+     * @param \Exception|null $cause The cause of this exception.
      */
-    public function __construct($message, $code = 0, Exception $cause = null)
+    public function __construct($message, $code = 0, \Exception $cause = null)
     {
         assert(is_string($message));
         assert(is_int($code));
@@ -60,11 +60,11 @@ class Exception extends \Exception
     /**
      * Convert any exception into a \SimpleSAML\Error\Exception.
      *
-     * @param Exception $e The exception.
+     * @param \Exception $e The exception.
      *
      * @return Exception The new exception.
      */
-    public static function fromException(Exception $e)
+    public static function fromException(\Exception $e)
     {
         if ($e instanceof Exception) {
             return $e;
@@ -76,9 +76,9 @@ class Exception extends \Exception
     /**
      * Load the backtrace from the given exception.
      *
-     * @param Exception $exception The exception we should fetch the backtrace from.
+     * @param \Exception $exception The exception we should fetch the backtrace from.
      */
-    protected function initBacktrace(Exception $exception)
+    protected function initBacktrace(\Exception $exception)
     {
         $this->backtrace = array();
 
diff --git a/lib/SimpleSAML/Error/UnserializableException.php b/lib/SimpleSAML/Error/UnserializableException.php
index 515b46091..54f4eb34f 100644
--- a/lib/SimpleSAML/Error/UnserializableException.php
+++ b/lib/SimpleSAML/Error/UnserializableException.php
@@ -28,9 +28,9 @@ class UnserializableException extends Exception
     /**
      * Create a serializable exception representing an unserializable exception.
      *
-     * @param Exception $original  The original exception.
+     * @param \Exception $original  The original exception.
      */
-    public function __construct(Exception $original)
+    public function __construct(\Exception $original)
     {
 
         $this->class = get_class($original);
diff --git a/lib/SimpleSAML/Memcache.php b/lib/SimpleSAML/Memcache.php
index 865610dd9..ab53ad46c 100644
--- a/lib/SimpleSAML/Memcache.php
+++ b/lib/SimpleSAML/Memcache.php
@@ -207,7 +207,7 @@ class Memcache
      *    The timeout for contacting this server, in seconds.
      *    The default value is 3 seconds.
      *
-     * @param Memcache $memcache The Memcache object we should add this server to.
+     * @param \Memcache $memcache The Memcache object we should add this server to.
      * @param array    $server An associative array with the configuration options for the server to add.
      *
      * @throws \Exception If any configuration option for the server is invalid.
@@ -304,19 +304,19 @@ class Memcache
      *
      * @param array $group Array of servers which should be created as a group.
      *
-     * @return Memcache A Memcache object of the servers in the group
+     * @return \Memcache A Memcache object of the servers in the group
      *
      * @throws \Exception If the servers configuration is invalid.
      */
     private static function loadMemcacheServerGroup(array $group)
     {
-        $class = class_exists('Memcache') ? 'Memcache' : (class_exists('Memcached') ? 'Memcached' : false);
+        $class = class_exists('\Memcache') ? '\Memcache' : (class_exists('\Memcached') ? '\Memcached' : false);
         if (!$class) {
             throw new \Exception('Missing Memcached implementation. You must install either the Memcache or Memcached extension.');
         }
         self::$extension = strtolower($class);
 
-        // create the Memcache object
+        // create the \Memcache object
         $memcache = new $class();
 
         // iterate over all the servers in the group and add them to the Memcache object
@@ -350,7 +350,7 @@ class Memcache
      * This function gets a list of all configured memcache servers. This list is initialized based
      * on the content of 'memcache_store.servers' in the configuration.
      *
-     * @return Memcache[] Array with Memcache objects.
+     * @return \Memcache[] Array with Memcache objects.
      *
      * @throws \Exception If the servers configuration is invalid.
      */
diff --git a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php
index ed575c555..47eec7be8 100644
--- a/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php
+++ b/lib/SimpleSAML/Metadata/MetaDataStorageHandlerPdo.php
@@ -169,12 +169,12 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource
 
             while ($d = $stmt->fetch()) {
                 if (++$rowCount > 1) {
-                    SimpleSAML\Logger::warning("Duplicate match for $entityId in set $set");
+                    \SimpleSAML\Logger::warning("Duplicate match for $entityId in set $set");
                     break;
                 }
                 $data = json_decode($d['entity_data'], true);
                 if ($data === null) {
-                    throw new SimpleSAML_Error_Exception("Cannot decode metadata for entity '${d['entity_id']}'");
+                    throw new \SimpleSAML\Error\Exception("Cannot decode metadata for entity '${d['entity_id']}'");
                 }
                 if (!array_key_exists('entityid', $data)) {
                     $data['entityid'] = $d['entity_id'];
@@ -182,7 +182,7 @@ class MetaDataStorageHandlerPdo extends MetaDataStorageSource
             }
             return $data;
         } else {
-            throw new Exception('PDO metadata handler: Database error: '.var_export($this->db->getLastError(), true));
+            throw new \Exception('PDO metadata handler: Database error: '.var_export($this->db->getLastError(), true));
         }
     }
 
diff --git a/lib/SimpleSAML/Stats.php b/lib/SimpleSAML/Stats.php
index 9329310b8..5a1dbf47f 100644
--- a/lib/SimpleSAML/Stats.php
+++ b/lib/SimpleSAML/Stats.php
@@ -38,7 +38,7 @@ class Stats
     private static function createOutput(\SimpleSAML\Configuration $config)
     {
         $cls = $config->getString('class');
-        $cls = SimpleSAML\Module::resolveClass($cls, 'Stats\Output', '\SimpleSAML\Stats\Output');
+        $cls = \SimpleSAML\Module::resolveClass($cls, 'Stats_Output', '\SimpleSAML\Stats\Output');
 
         $output = new $cls($config);
         return $output;
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 15739a034..e3ed6dedb 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -176,7 +176,7 @@ class Utilities
     /**
      * @deprecated This method will be removed in SSP 2.0. Please raise a SimpleSAML\Error\Error exception instead.
      */
-    public static function fatalError($trackId = 'na', $errorCode = null, Exception $e = null)
+    public static function fatalError($trackId = 'na', $errorCode = null, \Exception $e = null)
     {
         throw new \SimpleSAML\Error\Error($errorCode, $e);
     }
@@ -301,7 +301,7 @@ class Utilities
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::isDOMNodeOfType()
      *     instead.
      */
-    public static function isDOMElementOfType(DOMNode $element, $name, $nsURI)
+    public static function isDOMElementOfType(\DOMNode $element, $name, $nsURI)
     {
         return \SimpleSAML\Utils\XML::isDOMNodeOfType($element, $name, $nsURI);
     }
@@ -310,7 +310,7 @@ class Utilities
     /**
      * @deprecated This method will be removed in SSP 2.0. Please use SimpleSAML\Utils\XML::getDOMChildren() instead.
      */
-    public static function getDOMChildren(DOMElement $element, $localName, $namespaceURI)
+    public static function getDOMChildren(\DOMElement $element, $localName, $namespaceURI)
     {
         return \SimpleSAML\Utils\XML::getDOMChildren($element, $localName, $namespaceURI);
     }
@@ -570,7 +570,7 @@ class Utilities
         $session = \SimpleSAML\Session::getSessionFromRequest();
         $session->setData('core_postdatalink', $postId, $postData);
 
-        $redirInfo = base64_encode(SimpleSAML\Utils\Crypto::aesEncrypt($session->getSessionId().':'.$postId));
+        $redirInfo = base64_encode(\SimpleSAML\Utils\Crypto::aesEncrypt($session->getSessionId().':'.$postId));
 
         $url = \SimpleSAML\Module::getModuleURL('core/postredirect.php', array('RedirInfo' => $redirInfo));
         $url = preg_replace("#^https:#", "http:", $url);
@@ -694,7 +694,7 @@ class Utilities
      */
     public static function isWindowsOS()
     {
-        return \SimpleSAML\Utils\System::getOS() === SimpleSAML\Utils\System::WINDOWS;
+        return \SimpleSAML\Utils\System::getOS() === \SimpleSAML\Utils\System::WINDOWS;
     }
 
 
diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php
index 22d815be6..34b70132d 100644
--- a/lib/SimpleSAML/XHTML/IdPDisco.php
+++ b/lib/SimpleSAML/XHTML/IdPDisco.php
@@ -129,7 +129,7 @@ class IdPDisco
 
         // standard discovery service parameters
         if (!array_key_exists('entityID', $_GET)) {
-            throw new Exception('Missing parameter: entityID');
+            throw new \Exception('Missing parameter: entityID');
         } else {
             $this->spEntityId = $_GET['entityID'];
         }
@@ -176,7 +176,7 @@ class IdPDisco
      */
     protected function log($message)
     {
-        SimpleSAML\Logger::info('idpDisco.'.$this->instance.': '.$message);
+        \SimpleSAML\Logger::info('idpDisco.'.$this->instance.': '.$message);
     }
 
 
diff --git a/modules/consent/lib/Auth/Process/Consent.php b/modules/consent/lib/Auth/Process/Consent.php
index 342e110f2..639884570 100644
--- a/modules/consent/lib/Auth/Process/Consent.php
+++ b/modules/consent/lib/Auth/Process/Consent.php
@@ -10,8 +10,9 @@
  */
 
 use SimpleSAML\Logger;
+use SimpleSAML\Module;
 use SimpleSAML\Stats;
-use SimpleSAML\Error;
+use SimpleSAML\Utils;
 
 class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFilter
 {
@@ -53,7 +54,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
     /**
      * Attributes which should not require consent
      *
-     * @var aray
+     * @var array
      */
     private $_noconsentattributes = array();
 
@@ -73,7 +74,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
      * @param array $config Configuration information.
      * @param mixed $reserved For future use.
      *
-     * @throws Error\Exception if the configuration is not valid.
+     * @throws \SimpleSAML\Error\Exception if the configuration is not valid.
      */
     public function __construct($config, $reserved)
     {
@@ -82,7 +83,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
 
         if (array_key_exists('includeValues', $config)) {
             if (!is_bool($config['includeValues'])) {
-                throw new Error\Exception(
+                throw new \SimpleSAML\Error\Exception(
                     'Consent: includeValues must be boolean. '.
                     var_export($config['includeValues'], true).' given.'
                 );
@@ -92,7 +93,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
 
         if (array_key_exists('checked', $config)) {
             if (!is_bool($config['checked'])) {
-                throw new Error\Exception(
+                throw new \SimpleSAML\Error\Exception(
                     'Consent: checked must be boolean. '.
                     var_export($config['checked'], true).' given.'
                 );
@@ -102,7 +103,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
 
         if (array_key_exists('focus', $config)) {
             if (!in_array($config['focus'], array('yes', 'no'), true)) {
-                throw new Error\Exception(
+                throw new \SimpleSAML\Error\Exception(
                     'Consent: focus must be a string with values `yes` or `no`. '.
                     var_export($config['focus'], true).' given.'
                 );
@@ -112,7 +113,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
 
         if (array_key_exists('hiddenAttributes', $config)) {
             if (!is_array($config['hiddenAttributes'])) {
-                throw new Error\Exception(
+                throw new \SimpleSAML\Error\Exception(
                     'Consent: hiddenAttributes must be an array. '.
                     var_export($config['hiddenAttributes'], true).' given.'
                 );
@@ -122,7 +123,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
 
         if (array_key_exists('attributes.exclude', $config)) {
             if (!is_array($config['attributes.exclude'])) {
-                throw new Error\Exception(
+                throw new \SimpleSAML\Error\Exception(
                     'Consent: attributes.exclude must be an array. '.
                     var_export($config['attributes.exclude'], true).' given.'
                 );
@@ -131,7 +132,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
         } elseif (array_key_exists('noconsentattributes', $config)) {
             Logger::warning("The 'noconsentattributes' option has been deprecated in favour of 'attributes.exclude'.");
             if (!is_array($config['noconsentattributes'])) {
-                throw new Error\Exception(
+                throw new \SimpleSAML\Error\Exception(
                     'Consent: noconsentattributes must be an array. '.
                     var_export($config['noconsentattributes'], true).' given.'
                 );
@@ -152,7 +153,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
 
         if (array_key_exists('showNoConsentAboutService', $config)) {
             if (!is_bool($config['showNoConsentAboutService'])) {
-                throw new Error\Exception('Consent: showNoConsentAboutService must be a boolean.');
+                throw new \SimpleSAML\Error\Exception('Consent: showNoConsentAboutService must be a boolean.');
             }
             $this->_showNoConsentAboutService = $config['showNoConsentAboutService'];
         }
@@ -226,7 +227,7 @@ class sspmod_consent_Auth_Process_Consent extends \SimpleSAML\Auth\ProcessingFil
      *
      * @return void
      *
-     * @throws Error\NoPassive if the request was passive and consent is needed.
+     * @throws \SimpleSAML\Error\NoPassive if the request was passive and consent is needed.
      */
     public function process(&$state)
     {
diff --git a/modules/ldap/lib/ConfigHelper.php b/modules/ldap/lib/ConfigHelper.php
index e1f0fb64b..cc5e1e876 100644
--- a/modules/ldap/lib/ConfigHelper.php
+++ b/modules/ldap/lib/ConfigHelper.php
@@ -176,7 +176,7 @@ class sspmod_ldap_ConfigHelper
      *
      * @param string $username  The username the user wrote.
      * @param string $password  The password the user wrote.
-     * @param arrray $sasl_args  Array of SASL options for LDAP bind.
+     * @param array $sasl_args  Array of SASL options for LDAP bind.
      * @return array  Associative array with the users attributes.
      */
     public function login($username, $password, array $sasl_args = null)
diff --git a/modules/saml/www/disco.php b/modules/saml/www/disco.php
index 8a229f9f3..147338f0d 100644
--- a/modules/saml/www/disco.php
+++ b/modules/saml/www/disco.php
@@ -4,5 +4,5 @@
  * Built-in IdP discovery service.
  */
 
-$discoHandler = new \impleSAML\XHTML\IdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'saml');
+$discoHandler = new \SimpleSAML\XHTML\IdPDisco(array('saml20-idp-remote', 'shib13-idp-remote'), 'saml');
 $discoHandler->handleRequest();
diff --git a/www/_include.php b/www/_include.php
index 092e50089..a1bbe0e98 100644
--- a/www/_include.php
+++ b/www/_include.php
@@ -9,22 +9,20 @@ require_once(dirname(dirname(__FILE__)).'/lib/_autoload.php');
 // show error page on unhandled exceptions
 function SimpleSAML_exception_handler($exception)
 {
-    SimpleSAML\Module::callHooks('exception_handler', $exception);
+    \SimpleSAML\Module::callHooks('exception_handler', $exception);
 
     if ($exception instanceof \SimpleSAML\Error\Error) {
         $exception->show();
-    } elseif ($exception instanceof Exception) {
+    } elseif ($exception instanceof \Exception) {
         $e = new \SimpleSAML\Error\Error('UNHANDLEDEXCEPTION', $exception);
         $e->show();
-    } else {
-        if (class_exists('Error') && $exception instanceof Error) {
-            $code = $exception->getCode();
-            $errno = ($code > 0) ? $code : E_ERROR;
-            $errstr = $exception->getMessage();
-            $errfile = $exception->getFile();
-            $errline = $exception->getLine();
-            SimpleSAML_error_handler($errno, $errstr, $errfile, $errline);
-        }
+    } else if (class_exists('Error') && $exception instanceof \Error) {
+        $code = $exception->getCode();
+        $errno = ($code > 0) ? $code : E_ERROR;
+        $errstr = $exception->getMessage();
+        $errfile = $exception->getFile();
+        $errline = $exception->getLine();
+        SimpleSAML_error_handler($errno, $errstr, $errfile, $errline);
     }
 }
 
@@ -33,7 +31,7 @@ set_exception_handler('SimpleSAML_exception_handler');
 // log full backtrace on errors and warnings
 function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0, $errcontext = null)
 {
-    if (!class_exists('SimpleSAML\Logger')) {
+    if (!class_exists('\SimpleSAML\Logger')) {
         /* We are probably logging a deprecation-warning during parsing. Unfortunately, the autoloader is disabled at
          * this point, so we should stop here.
          *
@@ -42,7 +40,7 @@ function SimpleSAML_error_handler($errno, $errstr, $errfile = null, $errline = 0
         return false;
     }
 
-    if (SimpleSAML\Logger::isErrorMasked($errno)) {
+    if (\SimpleSAML\Logger::isErrorMasked($errno)) {
         // masked error
         return false;
     }
@@ -66,11 +64,11 @@ set_error_handler('SimpleSAML_error_handler');
 
 try {
     \SimpleSAML\Configuration::getInstance();
-} catch (Exception $e) {
+} catch (\Exception $e) {
     throw new \SimpleSAML\Error\CriticalConfigurationError(
         $e->getMessage()
     );
 }
 
 // set the timezone
-SimpleSAML\Utils\Time::initTimezone();
+\SimpleSAML\Utils\Time::initTimezone();
-- 
GitLab