diff --git a/lib/SimpleSAML/Logger/FileLoggingHandler.php b/lib/SimpleSAML/Logger/FileLoggingHandler.php index 64e6e21e562541451b941df92c711b8226570e36..a11eff283a85a2c59b204c69419a7bc5b42b3e1b 100644 --- a/lib/SimpleSAML/Logger/FileLoggingHandler.php +++ b/lib/SimpleSAML/Logger/FileLoggingHandler.php @@ -133,11 +133,20 @@ class FileLoggingHandler implements LoggingHandlerInterface array_push($replacements, date($format)); } - $this->fileSystem->appendToFile( - $this->logFile, - str_replace($formats, $replacements, $string) . \PHP_EOL, - false, - ); + if (preg_match('/^php:\/\//', $this->logFile)) { + // Dirty hack to get unit tests for Windows working.. Symfony doesn't deal well with them. + file_put_contents( + $this->logFile, + str_replace($formats, $replacements, $string) . \PHP_EOL, + FILE_APPEND, + ); + } else { + $this->fileSystem->appendToFile( + $this->logFile, + str_replace($formats, $replacements, $string) . \PHP_EOL, + false, + ); + } } } } diff --git a/lib/SimpleSAML/Module.php b/lib/SimpleSAML/Module.php index 4824cc2e4b825fa64064595878ea565e1f70b850..cb3d9be3bf55ca3d65254f17ba0630df9bb13e5a 100644 --- a/lib/SimpleSAML/Module.php +++ b/lib/SimpleSAML/Module.php @@ -505,7 +505,7 @@ class Module } $hooks = []; - $hook_dir = dirname(dirname(dirname(__FILE__))) . '/modules/' . $module . '/hooks'; + $hook_dir = Path::canonicalize(dirname(dirname(dirname(__FILE__))) . '/modules/' . $module . '/hooks'); if ((new Filesystem())->exists($hook_dir)) { $finder = new Finder(); $finder->files()->in($hook_dir)->depth(0); diff --git a/tests/lib/SimpleSAML/ModuleTest.php b/tests/lib/SimpleSAML/ModuleTest.php index 966f9c75f74cddfee3555f8a0ad90b5ac922cbe6..c5bb51e3cf96dd47216477e8abf03edddedb9664 100644 --- a/tests/lib/SimpleSAML/ModuleTest.php +++ b/tests/lib/SimpleSAML/ModuleTest.php @@ -8,6 +8,7 @@ use Exception; use PHPUnit\Framework\TestCase; use SimpleSAML\Configuration; use SimpleSAML\Module; +use Symfony\Component\Filesystem\Path; /** * @covers \SimpleSAML\Module @@ -31,8 +32,8 @@ class ModuleTest extends TestCase { // test for the most basic functionality $this->assertEquals( - dirname(dirname(dirname(dirname(__FILE__)))) . '/modules/module', - Module::getModuleDir('module') + Path::canonicalize(dirname(dirname(dirname(dirname(__FILE__)))) . '/modules/module'), + Path::canonicalize(Module::getModuleDir('module')), ); } @@ -121,7 +122,7 @@ class ModuleTest extends TestCase $hooks = Module::getModuleHooks('cron'); $this->assertArrayHasKey('configpage', $hooks); $this->assertEquals('cron_hook_configpage', $hooks['configpage']['func']); - $expectedFile = dirname(__DIR__, 3) . '/modules/cron/hooks/hook_configpage.php'; + $expectedFile = Path::canonicalize(dirname(__DIR__, 3) . '/modules/cron/hooks/hook_configpage.php'); $this->assertEquals($expectedFile, $hooks['configpage']['file']); }