diff --git a/lib/Saml2/Utils.php b/lib/Saml2/Utils.php index bc069a3e..f085159b 100644 --- a/lib/Saml2/Utils.php +++ b/lib/Saml2/Utils.php @@ -701,16 +701,14 @@ protected static function buildWithBaseURLPath($info) { $result = ''; $baseURLPath = self::getBaseURLPath(); - if (!empty($baseURLPath)) { - $result = $baseURLPath; - if (!empty($info)) { - $path = explode('/', $info); - $extractedInfo = array_pop($path); - if (!empty($extractedInfo)) { - $result .= $extractedInfo; - } + if (!empty($baseURLPath) && !empty($info)) { + $path = explode('/', $info); + if (count($path) > 1) { + $info = implode(array_filter($path), '/'); } + $result .= $baseURLPath . $info; } + return $result; }