[DI] made the %env(base64:...)% processor able to decode base64url

This commit is contained in:
Nicolas Grekas 2019-10-17 14:47:46 +02:00
parent f5cef028f8
commit 3d12e46692
3 changed files with 8 additions and 1 deletions

View File

@ -14,6 +14,7 @@ CHANGELOG
* added ability to define a static priority method for tagged service
* added support for improved syntax to define method calls in Yaml
* added `LazyString` for lazy computation of string values injected into services
* made the `%env(base64:...)%` processor able to decode base64url
4.3.0
-----

View File

@ -173,7 +173,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
}
if ('base64' === $prefix) {
return base64_decode($env);
return base64_decode(strtr($env, '-_', '+/'));
}
if ('json' === $prefix) {

View File

@ -231,6 +231,12 @@ class EnvVarProcessorTest extends TestCase
});
$this->assertSame('hello', $result);
$result = $processor->getEnv('base64', 'foo', function ($name) { return '/+0='; });
$this->assertSame("\xFF\xED", $result);
$result = $processor->getEnv('base64', 'foo', function ($name) { return '_-0='; });
$this->assertSame("\xFF\xED", $result);
}
public function testGetEnvTrim()