From 09b30417136de9fdc8a80f7dd7f3e27d7f9a4b31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jaime=20Pe=CC=81rez?= <jaime.perez@uninett.no>
Date: Tue, 26 Jul 2016 09:45:19 +0200
Subject: [PATCH] Prepare to bump the version of XMLSecLibs that we are using.

The 2.x branch of XMLSecLibs uses namespaces, so we need to make sure we can still load the XMLSec* classes after updating the dependency. We can do that in the autoloader, looking for the classes with namespaces, and creating class aliases.
---
 lib/_autoload_modules.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/_autoload_modules.php b/lib/_autoload_modules.php
index 5eb8d2fdb..1cbe07459 100644
--- a/lib/_autoload_modules.php
+++ b/lib/_autoload_modules.php
@@ -19,6 +19,14 @@
  */
 function temporaryLoader($class)
 {
+    // handle the upgrade to the latest version of XMLSecLibs using namespaces
+    if (strstr($class, 'XMLSec')) {
+        if (class_exists('\\RobRichards\\XMLSecLibs\\'.$class, true)) {
+            class_alias('\\RobRichards\\XMLSecLibs\\'.$class, $class);
+            return;
+        }
+    }
+
     if (!strstr($class, 'SimpleSAML_')) {
         return; // not a valid class name for old classes
     }
-- 
GitLab