From c536aa24a340b88b82c5daafdcc15876c60f3f7c Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Fri, 20 Jun 2008 10:37:17 +0000
Subject: [PATCH] Utilities::resolvePath: Fix handling of absolute paths.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@675 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Utilities.php | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index abe0bf12a..d31343435 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -985,7 +985,14 @@ class SimpleSAML_Utilities {
 			$base = substr($base, 0, -1);
 		}
 
-		$ret = $base;
+		/* Check for absolute path. */
+		if(substr($path, 0, 1) === '/') {
+			/* Absolute path. */
+			$ret = '/';
+		} else {
+			/* Path relative to base. */
+			$ret = $base;
+		}
 
 		$path = explode('/', $path);
 		foreach($path as $d) {
-- 
GitLab