Skip to content
Snippets Groups Projects
Unverified Commit 863e46d8 authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

bugfix: Allow loading the old sspmod_adfs_SAML2_XML_fed_Const class.

Since the class cannot be named "Const" when using namespaces, due to "const" being a reserved word, we needed to rename the class. That requires also some logic in the autoloader to map the old name to the new one.
parent c09b344f
No related branches found
No related tags found
No related merge requests found
...@@ -87,9 +87,22 @@ function sspmodAutoloadPSR0($className) ...@@ -87,9 +87,22 @@ function sspmodAutoloadPSR0($className)
return; return;
} }
$modNameEnd = strpos($className, '_', $modulePrefixLength); // list of classes that have been renamed or moved
$module = substr($className, $modulePrefixLength, $modNameEnd - $modulePrefixLength); $renamed = [
$path = explode('_', substr($className, $modNameEnd + 1)); 'sspmod_adfs_SAML2_XML_fed_Const' => [
'module' => 'adfs',
'path' => ['SAML2', 'XML', 'fed', 'Constants']
],
];
if (array_key_exists($className, $renamed)) {
// the class has been renamed, try to load it and create an alias
$module = $renamed[$className]['module'];
$path = $renamed[$className]['path'];
} else {
$modNameEnd = strpos($className, '_', $modulePrefixLength);
$module = substr($className, $modulePrefixLength, $modNameEnd - $modulePrefixLength);
$path = explode('_', substr($className, $modNameEnd + 1));
}
if (!\SimpleSAML\Module::isModuleEnabled($module)) { if (!\SimpleSAML\Module::isModuleEnabled($module)) {
return; return;
......
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