8000 bug #34757 [DI] Fix making the container path-independent when the ap… · symfony/symfony@30294c4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 30294c4

Browse files
committed
bug #34757 [DI] Fix making the container path-independent when the app is in /app (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [DI] Fix making the container path-independent when the app is in /app | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34750, Fix #34611 | License | MIT | Doc PR | - Right now, we mandate the app to be nested in a directory of level 2 minimum. This means apps cannot be made path-independent if they are built in e.g. `/app`. Commits ------- b33b9a6 [DI] Fix making the container path-independent when the app is in /app
2 parents 7a13ea3 + b33b9a6 commit 30294c4

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