From a3e35a6cdcb7e72a70e5cf6f39a2648e6dba68e8 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Tue, 18 May 2010 09:33:53 +0000 Subject: [PATCH] SimpleSAML_Configuration::resolvePath(): Support absolute path on windows. Thanks to c960657 <http://code.google.com/u/c960657/> for providing this patch. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2299 44740490-163a-0410-bde0-09ae8108e29a --- lib/SimpleSAML/Configuration.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 61081c06f..700dd52d9 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -361,10 +361,12 @@ class SimpleSAML_Configuration { assert('is_string($path)'); - /* Prepend path with basedir if it doesn't start with - * a slash. We assume getBaseDir ends with a slash. + /* Prepend path with basedir if it doesn't start with a slash or a Windows + * drive letter (e.g. "C:\"). We assume getBaseDir ends with a slash. */ - if ($path[0] !== '/') $path = $this->getBaseDir() . $path; + if ($path[0] !== '/' && + !(preg_match('@^[a-z]:[\\\\/]@i', $path, $matches) && is_dir($matches[0]))) + $path = $this->getBaseDir() . $path; /* Remove trailing slashes. */ while (substr($path, -1) === '/') { -- GitLab