8000 [DependencyInjection] fix "url" env var processor · symfony/symfony@5a75f48 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a75f48

Browse files
[DependencyInjection] fix "url" env var processor
1 parent 6aa673f commit 5a75f48

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