Skip to content
Snippets Groups Projects
Commit 425db89b authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Make sure the new SimpleSAML_Configuration::getBasePath() complies with its...

Make sure the new SimpleSAML_Configuration::getBasePath() complies with its phpdoc, returning always at least a slash. Fix also the regex that's supposed to catch paths, as it still wants them to end with a slash.
parent ae40335b
No related branches found
No related tags found
No related merge requests found
......@@ -487,16 +487,16 @@ class SimpleSAML_Configuration
if (preg_match('#^https?://[^/]*(?:/(.+/?)?)?$#', $baseURL, $matches)) {
// we have a full url, we need to strip the path
if (!array_key_exists(1, $matches)) {
// root directory specified with an absolute URL
return '';
// absolute URL without path
return '/';
}
return rtrim($matches[1], '/')."/";
return '/'.rtrim($matches[1], '/')."/";
} elseif ($baseURL === '' || $baseURL === '/') {
// root directory of site
return '';
} elseif (preg_match('#^/?([^/]?.*/)#D', $baseURL, $matches)) {
return '/';
} elseif (preg_match('#^/?((?:[^/\s]+/?)+)#', $baseURL, $matches)) {
// local path only
return $matches[1];
return '/'.rtrim($matches[1], '/').'/';
} else {
/*
* Invalid 'baseurlpath'. We cannot recover from this, so throw a critical exception and try to be graceful
......
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