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:
commit
a721a50aa0
@ -14,6 +14,7 @@ CHANGELOG
|
|||||||
* added ability to define a static priority method for tagged service
|
* added ability to define a static priority method for tagged service
|
||||||
* added support for improved syntax to define method calls in Yaml
|
* added support for improved syntax to define method calls in Yaml
|
||||||
* added `LazyString` for lazy computation of string values injected into services
|
* added `LazyString` for lazy computation of string values injected into services
|
||||||
|
* made the `%env(base64:...)%` processor able to decode base64url
|
||||||
|
|
||||||
4.3.0
|
4.3.0
|
||||||
-----
|
-----
|
||||||
|
@ -173,7 +173,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ('base64' === $prefix) {
|
if ('base64' === $prefix) {
|
||||||
return base64_decode($env);
|
return base64_decode(strtr($env, '-_', '+/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('json' === $prefix) {
|
if ('json' === $prefix) {
|
||||||
|
@ -231,6 +231,12 @@ class EnvVarProcessorTest extends TestCase
|
|||||||
});
|
});
|
||||||
|
|
||||||
$this->assertSame('hello', $result);
|
$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()
|
public function testGetEnvTrim()
|
||||||
|
Reference in New Issue
Block a user