feature #34014 [DI] made the %env(base64:...)% processor able to decode base64url (nicolas-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

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

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

3d12e46692 [DI] made the `%env(base64:...)%` processor able to decode base64url
This commit is contained in:
Nicolas Grekas 2019-10-22 08:40:20 +02:00
commit a721a50aa0
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()