diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index c9ff286f1c99c988e594b6497e29629cbbcec0ff..515f4ab14ce077a908c7beaba76cb37f2e73a412 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -42,14 +42,15 @@ class Module } require_once($file); - if (!class_exists($className, false)) { + if (!class_exists($className, false) && !interface_exists($className, false)) { // the file exists, but the class is not defined. Is it using namespaces? $nspath = join('\\', $path); - if (class_exists('SimpleSAML\Module\\'.$module.'\\'.$nspath)) { + if (class_exists('SimpleSAML\Module\\'.$module.'\\'.$nspath) || + interface_exists('SimpleSAML\Module\\'.$module.'\\'.$nspath)) { // the class has been migrated, create an alias and warn about it \SimpleSAML\Logger::warning( - "The class '$className' is now using namespaces, please use 'SimpleSAML\\Module\\$module\\". - "$nspath' instead." + "The class or interface '$className' is now using namespaces, please use 'SimpleSAML\\Module\\". + $module."\\".$nspath."' instead." ); class_alias("SimpleSAML\\Module\\$module\\$nspath", $className); } diff --git a/lib/_autoload_modules.php b/lib/_autoload_modules.php index 3e0c6cecf518d523faf73b562a5fb51b8a89ec5c..0903896ba568a6ef7e6cae3ee31cc4d2e641f40c 100644 --- a/lib/_autoload_modules.php +++ b/lib/_autoload_modules.php @@ -31,18 +31,17 @@ function temporaryLoader($class) } // it exists, so it's not yet migrated to namespaces - if (class_exists($class, false)) { + if (class_exists($class, false) || interface_exists($class, false)) { return; } // it didn't exist, try to see if it was migrated to namespaces $new = join('\\', $path); - if (class_exists($new, false)) { // do not try to autoload it if it doesn't exist! It should! + if (class_exists($new, false) || interface_exists($class, false)) { + // do not try to autoload it if it doesn't exist! It should! class_alias($new, $class); - SimpleSAML\Logger::warning("The class '$class' is now using namespaces, please use '$new'."); + SimpleSAML\Logger::warning("The class or interface '$class' is now using namespaces, please use '$new'."); } - - } spl_autoload_register("temporaryLoader");