Skip to content

Commit 48be696

Browse files
Merge branch '5.2' into 5.x
* 5.2: fixed parser Fixed bugs found by psalm [FrameworkBundle] Dont store cache misses on warmup fix test Update references to the ContainerConfigurator [Translation] Remove file added back from a bad merge Fix sleep value [Cache] skip storing failure-to-save as misses in ArrayAdapter [Validator] Delete obsolete statement in Regex::getHtmlPattern() phpDoc [FrameworkBundle] Remove author comments for configuration and extension [Stopwatch] Document new "name" property of StopwatchEvent [DependencyInjection] Fix "url" env var processor behavior when the url has no path Fixed support for nodes not extending BaseNode [FrameworkBundle] dont access the container to configure http_cache add missing queue_name to find(id) in doctrine messenger transport [Config][FrameworkBundle] Hint to use PHP 8+ or to install Annotations to use attributes/annots [Serializer] AbstractNormalizer force null for non-optional nullable constructor parameter denormalization when not present in input
2 parents a657ccb + d0ea7d0 commit 48be696

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function setChanges(array $changes)
9696
/**
9797
* Sets a factory.
9898
*
99-
* @param string|array|Reference $factory A PHP function, reference or an array containing a class/Reference and a method to call
99+
* @param string|array|Reference|null $factory A PHP function, reference or an array containing a class/Reference and a method to call
100100
*
101101
* @return $this
102102
*/

EnvVarProcessor.php

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

261-
// remove the '/' separator
262-
$parsedEnv['path'] = '/' === $parsedEnv['path'] ? null : substr($parsedEnv['path'], 1);
261+
if (null !== $parsedEnv['path']) {
262+
// remove the '/' separator
263+
$parsedEnv['path'] = '/' === $parsedEnv['path'] ? null : substr($parsedEnv['path'], 1);
264+
}
263265

264266
return $parsedEnv;
265267
}

Tests/EnvVarProcessorTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,4 +626,26 @@ public function testGetEnvInvalidPrefixWithDefault()
626626
return null;
627627
});
628628
}
629+
630+
/**
631+
* @dataProvider provideGetEnvUrlPath
632+
*/
633+
public function testGetEnvUrlPath(?string $expected, string $url)
634+
{
635+
$this->assertSame($expected, (new EnvVarProcessor(new Container()))->getEnv('url', 'foo', static function () use ($url): string {
636+
return $url;
637+
})['path']);
638+
}
639+
640+
public function provideGetEnvUrlPath()
641+
{
642+
return [
643+
[null, 'https://symfony.com'],
644+
[null, 'https://symfony.com/'],
645+
['/', 'https://symfony.com//'],
646+
['blog', 'https://symfony.com/blog'],
647+
['blog/', 'https://symfony.com/blog/'],
648+
['blog//', 'https://symfony.com/blog//'],
649+
];
650+
}
629651
}

0 commit comments

Comments
 (0)