Skip to content
Snippets Groups Projects
Commit e58285d9 authored by Tim van Dijen's avatar Tim van Dijen
Browse files

Fix Kernel to properly handle Windows paths

parent 9f561574
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ declare(strict_types=1); ...@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace SimpleSAML; namespace SimpleSAML;
use SimpleSAML\Utils\System;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
...@@ -51,7 +52,7 @@ class Kernel extends BaseKernel ...@@ -51,7 +52,7 @@ class Kernel extends BaseKernel
$configuration = Configuration::getInstance(); $configuration = Configuration::getInstance();
$cachePath = $configuration->getString('tempdir') . '/cache/' . $this->module; $cachePath = $configuration->getString('tempdir') . '/cache/' . $this->module;
if (0 === strpos($cachePath, '/')) { if (System::isAbsolutePath($cachePath)) {
return $cachePath; return $cachePath;
} }
...@@ -67,7 +68,7 @@ class Kernel extends BaseKernel ...@@ -67,7 +68,7 @@ class Kernel extends BaseKernel
$configuration = Configuration::getInstance(); $configuration = Configuration::getInstance();
$loggingPath = $configuration->getString('loggingdir'); $loggingPath = $configuration->getString('loggingdir');
if (0 === strpos($loggingPath, '/')) { if (System::isAbsolutePath($loggingPath)) {
return $loggingPath; return $loggingPath;
} }
......
...@@ -238,6 +238,20 @@ class System ...@@ -238,6 +238,20 @@ class System
} }
} }
/**
* Check if the supplied path is an absolute path.
*
* @param string $path
*
* @return bool
*/
public static function isAbsolutePath(string $path): bool
{
return (0 === strpos($path, '/') || self::pathContainsDriveLetter($path));
}
/** /**
* Check if the supplied path contains a Windows-style drive letter. * Check if the supplied path contains a Windows-style drive letter.
* *
......
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