Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/system/console/WinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
42 changes: 20 additions & 22 deletions modules/system/traits/ViewMaker.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down