Skip to content

Commit 3d12e46

Browse files
[DI] made the %env(base64:...)% processor able to decode base64url
1 parent f5cef02 commit 3d12e46

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CHANGELOG
1414
* added ability to define a static priority method for tagged service
1515
* added support for improved syntax to define method calls in Yaml
1616
* added `LazyString` for lazy computation of string values injected into services
17+
* made the `%env(base64:...)%` processor able to decode base64url
1718

1819
4.3.0
1920
-----

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function getEnv($prefix, $name, \Closure $getEnv)
173173
}
174174

175175
if ('base64' === $prefix) {
176-
return base64_decode($env);
176+
return base64_decode(strtr($env, '-_', '+/'));
177177
}
178178

179179
if ('json' === $prefix) {

src/Symfony/Component/DependencyInjection/Tests/EnvVarProcessorTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,12 @@ public function testGetEnvBase64()
231231
});
232232

233233
$this->assertSame('hello', $result);
234+
235+
$result = $processor->getEnv('base64', 'foo', function ($name) { return '/+0='; });
236+
$this->assertSame("\xFF\xED", $result);
237+
238+
$result = $processor->getEnv('base64', 'foo', function ($name) { return '_-0='; });
239+
$this->assertSame("\xFF\xED", $result);
234240
}
235241

236242
public function testGetEnvTrim()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy