diff --git a/modules/system/console/WinterTest.php b/modules/system/console/WinterTest.php index f66b15b21f..db8e108d7e 100644 --- a/modules/system/console/WinterTest.php +++ b/modules/system/console/WinterTest.php @@ -143,7 +143,7 @@ protected function execPhpUnit(string $config, array $args): int $process = new Process( array_merge([$this->phpUnitExec, '--configuration=' . $config], $args), - dirname($config), + base_path(), null, null ); diff --git a/modules/system/traits/ViewMaker.php b/modules/system/traits/ViewMaker.php index a9cc1f2e1f..8407e4e033 100644 --- a/modules/system/traits/ViewMaker.php +++ b/modules/system/traits/ViewMaker.php @@ -186,32 +186,30 @@ public function getViewPath(string $fileName, string|array $viewPaths = null): s $fileName = substr($fileName, 0, strrpos($fileName, '.')); } - - if (File::isPathSymbol($fileName)) { - // Handle path symbols - $absolutePath = File::symbolizePath($fileName); + // Check if this a path relative to the view paths + foreach ($viewPaths as $path) { + $absolutePath = File::symbolizePath($path); foreach ($allowedExtensions as $ext) { - $viewPath = $absolutePath . ".$ext"; - - if ( - File::isLocalPath($viewPath) - || ( - !Config::get('cms.restrictBaseDir', true) - && realpath($viewPath) !== false - ) - ) { + $viewPath = $absolutePath . DIRECTORY_SEPARATOR . $fileName . ".$ext"; + if (File::isFile($viewPath)) { return $viewPath; } } - } else { - foreach ($viewPaths as $path) { - $absolutePath = File::symbolizePath($path); - foreach ($allowedExtensions as $ext) { - $viewPath = $absolutePath . DIRECTORY_SEPARATOR . $fileName . ".$ext"; - if (File::isFile($viewPath)) { - return $viewPath; - } - } + } + + // Next, check if this is a local path reference + $absolutePath = File::symbolizePath($fileName); + foreach ($allowedExtensions as $ext) { + $viewPath = $absolutePath . ".$ext"; + + if ( + File::isLocalPath($viewPath) + || ( + !Config::get('cms.restrictBaseDir', true) + && realpath($viewPath) !== false + ) + ) { + return $viewPath; } }