Skip to content
Snippets Groups Projects
Commit 5af5f995 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fix for sspmod_ class with namespaced $type

parent 03c6b6e0
No related branches found
No related tags found
No related merge requests found
......@@ -392,20 +392,18 @@ class Module
} else {
// should be a module
// make sure empty types are handled correctly
$type = (empty($type)) ? '_' : '_'.$type.'_';
// check for the old-style class names
$className = 'sspmod_'.$tmp[0].$type.$tmp[1];
$type = (empty($type)) ? '\\' : '\\'.$type.'\\';
$className = 'SimpleSAML\\Module\\'.$tmp[0].$type.$tmp[1];
if (!class_exists($className)) {
// check for the new-style class names, using namespaces
$type = str_replace('_', '\\', $type);
$newClassName = 'SimpleSAML\\Module\\'.$tmp[0].$type.$tmp[1];
// check for the old-style class names
$type = str_replace('\\', '_', $type);
$oldClassName = 'sspmod_'.$tmp[0].$type.$tmp[1];
if (!class_exists($newClassName)) {
throw new \Exception("Could not resolve '$id': no class named '$className' or '$newClassName'.");
if (!class_exists($oldClassName)) {
throw new \Exception("Could not resolve '$id': no class named '$className' or '$oldClassName'.");
}
$className = $newClassName;
$className = $oldClassName;
}
}
......
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