diff options
author | Jaime Pérez <jaime.perez@uninett.no> | 2016-07-05 12:21:54 +0200 |
---|---|---|
committer | Jaime Pérez <jaime.perez@uninett.no> | 2016-07-05 12:24:28 +0200 |
commit | 93793d935e584fe2075dcf9984661f9915547ed4 (patch) | |
tree | 71f7aae1b6f6c40b62a28803a3efeb6f59ec4556 /lib/SimpleSAML | |
parent | 13cdb4004e697bbf58bc166fcd4f2ae1d14b20a0 (diff) | |
download | simplesamlphp-93793d935e584fe2075dcf9984661f9915547ed4.zip simplesamlphp-93793d935e584fe2075dcf9984661f9915547ed4.tar.gz simplesamlphp-93793d935e584fe2075dcf9984661f9915547ed4.tar.bz2 |
bugfix: Restore support for windows machines.
Due to recent changes to fix the way we were building URLs (mixing what the 'baseurlpath' configuration option and the current URL, see #396), we introduced another bug by assuming file paths will always use slashes ('/'), which obviously is not true in Windows machines. This commit fixes SimpleSAML_Configuration::getBaseDir() and SimpleSAML\Utils\HTTP::getSelfURL() to take that into account.
This closes #414.
Diffstat (limited to 'lib/SimpleSAML')
-rw-r--r-- | lib/SimpleSAML/Configuration.php | 8 | ||||
-rw-r--r-- | lib/SimpleSAML/Utils/HTTP.php | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index b5ce246..088b662 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -595,8 +595,8 @@ class SimpleSAML_Configuration $dir = $this->getString('basedir', null); if ($dir !== null) { // add trailing slash if it is missing - if (substr($dir, -1) !== '/') { - $dir .= '/'; + if (substr($dir, -1) !== DIRECTORY_SEPARATOR) { + $dir .= DIRECTORY_SEPARATOR; } return $dir; @@ -614,8 +614,8 @@ class SimpleSAML_Configuration $dir = dirname($dir); - // Add trailing slash - $dir .= '/'; + // Add trailing directory separator + $dir .= DIRECTORY_SEPARATOR; return $dir; } diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php index 612bf5c..de6149f 100644 --- a/lib/SimpleSAML/Utils/HTTP.php +++ b/lib/SimpleSAML/Utils/HTTP.php @@ -724,7 +724,11 @@ class HTTP $url = self::getBaseURL(); $cfg = \SimpleSAML_Configuration::getInstance(); $baseDir = $cfg->getBaseDir(); - $rel_path = str_replace($baseDir.'www/', '', realpath($_SERVER['SCRIPT_FILENAME'])); + $rel_path = str_replace( + DIRECTORY_SEPARATOR, + '/', + str_replace($baseDir.'www'.DIRECTORY_SEPARATOR, '', realpath($_SERVER['SCRIPT_FILENAME'])) + ); $pos = strpos($_SERVER['REQUEST_URI'], $rel_path) + strlen($rel_path); return $url.$rel_path.substr($_SERVER['REQUEST_URI'], $pos); } |