8000 [DI] Fix making the container path-independent when the app is in /app · symfony/symfony@b33b9a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit b33b9a6

Browse files
[DI] Fix making the container path-independent when the app is in /app
1 parent 7a13ea3 commit b33b9a6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ public function dump(array $options = [])
173173
if (!empty($options['file']) && is_dir($dir = \dirname($options['file']))) {
174174
// Build a regexp where the first root dirs are mandatory,
175175
// but every other sub-dir is optional up to the full path in $dir
176-
// Mandate at least 2 root dirs and not more that 5 optional dirs.
176+
// Mandate at least 1 root dir and not more than 5 optional dirs.
177177

178178
$dir = explode(\DIRECTORY_SEPARATOR, realpath($dir));
179179
$i = \count($dir);
180180

181-
if (3 <= $i) {
181+
if (2 + (int) ('\\' === \DIRECTORY_SEPARATOR) <= $i) {
182182
$regex = '';
183-
$lastOptionalDir = $i > 8 ? $i - 5 : 3;
183+
$lastOptionalDir = $i > 8 ? $i - 5 : (2 + (int) ('\\' === \DIRECTORY_SEPARATOR));
184184
$this->targetDirMaxMatches = $i - $lastOptionalDir;
185185

186186
while (--$i >= $lastOptionalDir) {

0 commit comments

Comments
 (0)
0