Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f0bd98

Browse files
committed
canonicalize paths
1 parent 9ca8e27 commit 8f0bd98

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

core-bundle/src/Twig/Loader/ContaoFilesystemLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function getDynamicParent(string $shortNameOrIdentifier, string $sourcePa
224224
}
225225

226226
// Find the next element in the hierarchy or use the first if it cannot be found
227-
$index = array_search($sourcePath, array_keys($chain), true);
227+
$index = array_search(Path::canonicalize($sourcePath), array_keys($chain), true);
228228
$next = array_values($chain)[false !== $index ? $index + 1 : 0] ?? null;
229229

230230
if (null === $next) {

core-bundle/src/Twig/Loader/TemplateLocator.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ public function findResourcesPaths(): array
7777
$paths[$group] = array_merge(
7878
$paths[$group] ?? [],
7979
$this->expandSubdirectories($basePath)
80-
)
81-
;
80+
);
8281
};
8382

8483
if (is_dir($path = Path::join($this->projectDir, 'contao'))) {
@@ -126,7 +125,7 @@ public function findTemplates(string $path): array
126125
$templates = [];
127126

128127
foreach ($finder as $file) {
129-
$templates[$file->getFilename()] = $file->getPathname();
128+
$templates[$file->getFilename()] = Path::canonicalize($file->getPathname());
130129
}
131130

132131
return $templates;
@@ -150,7 +149,7 @@ private function expandSubdirectories(string $path): array
150149
];
151150

152151
foreach ($finder as $item) {
153-
$paths[] = $item->getPathname();
152+
$paths[] = Path::canonicalize($item->getPathname());
154153
}
155154

156155
return array_reverse($paths);

0 commit comments

Comments
 (0)