8000 bug #43545 [DependencyInjection] fix "url" env var processor (nicolas… · symfony/symfony@842b3f1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 842b3f1

Browse files
committed
bug #43545 [DependencyInjection] fix "url" env var processor (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] fix "url" env var processor | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #43258 | License | MIT | Doc PR | - Commits ------- 5a75f48 [DependencyInjection] fix "url" env var processor
2 parents 09e0a6e + 5a75f48 commit 842b3f1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,8 @@ public function getEnv($prefix, $name, \Closure $getEnv)
255255
'fragment' => null,
256256
];
257257

258-
if (null !== $parsedEnv['path']) {
259-
// remove the '/' separator
260-
$parsedEnv['path'] = '/' === $parsedEnv['path'] ? null : substr($parsedEnv['path'], 1);
261-
}
258+
// remove the '/' separator
259+
$parsedEnv['path'] = '/' === ($parsedEnv['path'] ?? '/') ? '' : substr($parsedEnv['path'], 1);
262260

263261
return $parsedEnv;
264262
}

src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ public function testGetEnvUrlPath(?string $expected, string $url)
624624
public function provideGetEnvUrlPath()
625625
{
626626
return [
627-
[null, 'https://symfony.com'],
628-
[null, 'https://symfony.com/'],
627+
['', 'https://symfony.com'],
628+
['', 'https://symfony.com/'],
629629
['/', 'https://symfony.com//'],
630630
['blog', 'https://symfony.com/blog'],
631631
['blog/', 'https://symfony.com/blog/'],

0 commit comments

Comments
 (0)
0