Skip to content

Commit d0ea7d0

Browse files
Merge branch '4.4' into 5.2
* 4.4: fixed parser Fixed bugs found by psalm [FrameworkBundle] Dont store cache misses on warmup [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 [DependencyInjection] Fix "url" env var processor behavior when the url has no path Fixed support for nodes not extending BaseNode add missing queue_name to find(id) in doctrine messenger transport [Serializer] AbstractNormalizer force null for non-optional nullable constructor parameter denormalization when not present in input
2 parents 1e66194 + f074529 commit d0ea7d0

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
@@ -255,8 +255,10 @@ public function getEnv(string $prefix, string $name, \Closure $getEnv)
255255
'fragment' => null,
256256
];
257257

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

261263
return $parsedEnv;
262264
}

Tests/EnvVarProcessorTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,26 @@ public function testGetEnvInvalidPrefixWithDefault()
610610
return null;
611611
});
612612
}
613+
614+
/**
615+
* @dataProvider provideGetEnvUrlPath
616+
*/
617+
public function testGetEnvUrlPath(?string $expected, string $url)
618+
{
619+
$this->assertSame($expected, (new EnvVarProcessor(new Container()))->getEnv('url', 'foo', static function () use ($url): string {
620+
return $url;
621+
})['path']);
622+
}
623+
624+
public function provideGetEnvUrlPath()
625+
{
626+
return [
627+
[null, 'https://symfony.com'],
628+
[null, 'https://symfony.com/'],
629+
['/', 'https://symfony.com//'],
630+
['blog', 'https://symfony.com/blog'],
631+
['blog/', 'https://symfony.com/blog/'],
632+
['blog//', 'https://symfony.com/blog//'],
633+
];
634+
}
613635
}

0 commit comments

Comments
 (0)