Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a3991d

Browse files
committed
bug #47533 [Messenger] decode URL-encoded characters in DSN's usernames/passwords (xabbuh)
This PR was merged into the 4.4 branch. Discussion ---------- [Messenger] decode URL-encoded characters in DSN's usernames/passwords | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #45549 | License | MIT | Doc PR | Commits ------- 7ae7d7b decode URL-encoded characters in DSN's usernames/passwords
2 parents 7023db1 + 7ae7d7b commit 7a3991d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/Messenger/Transport/AmqpExt/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ public static function fromDsn(string $dsn, array $options = [], AmqpFactory $am
126126
], $options, $parsedQuery);
127127

128128
if (isset($parsedUrl['user'])) {
129-
$amqpOptions['login'] = $parsedUrl['user'];
129+
$amqpOptions['login'] = urldecode($parsedUrl['user']);
130130
}
131131

132132
if (isset($parsedUrl['pass'])) {
133-
$amqpOptions['password'] = $parsedUrl['pass'];
133+
$amqpOptions['password'] = urldecode($parsedUrl['pass']);
134134
}
135135

136136
if (!isset($amqpOptions['queues'])) {

src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public static function fromDsn(string $dsn, array $redisOptions = [], \Redis $re
9393
$stream = $pathParts[1] ?? $redisOptions['stream'] ?? null;
9494
$group = $pathParts[2] ?? $redisOptions['group'] ?? null;
9595
$consumer = $pathParts[3] ?? $redisOptions['consumer'] ?? null;
96-
$pass = '' !== ($parsedUrl['pass'] ?? '') ? $parsedUrl['pass'] : null;
97-
$user = '' !== ($parsedUrl['user'] ?? '') ? $parsedUrl['user'] : null;
96+
$pass = '' !== ($parsedUrl['pass'] ?? '') ? urldecode($parsedUrl['pass']) : null;
97+
$user = '' !== ($parsedUrl['user'] ?? '') ? urldecode($parsedUrl['user']) : null;
9898

9999
$connectionCredentials = [
100100
'host' => $parsedUrl['host'] ?? '127.0.0.1',

0 commit comments

Comments
 (0)