Skip to content

Commit aa5ca01

Browse files
bug #39967 [Messenger] fix redis messenger options with dsn (Kleinast)
This PR was submitted for the 5.1 branch but it was merged into the 4.4 branch instead. Discussion ---------- [Messenger] fix redis messenger options with dsn | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #39834 | License | MIT This will fix the fact that you can use framework.messenger.transports.*.options to complete/default your redis configuration Commits ------- a0e7bf4 fix redis messenger options with dsn
2 parents d244e79 + a0e7bf4 commit aa5ca01

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Symfony/Component/Messenger/Tests/Transport/RedisExt/ConnectionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,19 @@ public function testFromDsnWithQueryOptions()
8585
);
8686
}
8787

88+
public function testFromDsnWithMixDsnQueryOptions()
89+
{
90+
$this->assertEquals(
91+
Connection::fromDsn('redis://localhost/queue/group1?serializer=2', ['consumer' => 'specific-consumer']),
92+
Connection::fromDsn('redis://localhost/queue/group1/specific-consumer?serializer=2')
93+
);
94+
95+
$this->assertEquals(
96+
Connection::fromDsn('redis://localhost/queue/group1/consumer1', ['consumer' => 'specific-consumer']),
97+
Connection::fromDsn('redis://localhost/queue/group1/consumer1')
98+
);
99+
}
100+
88101
public function testKeepGettingPendingMessages()
89102
{
90103
$redis = $this->getMockBuilder(\Redis::class)->disableOriginalConstructor()->getMock();

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public static function fromDsn(string $dsn, array $redisOptions = [], \Redis $re
101101
];
102102

103103
if (isset($parsedUrl['query'])) {
104-
parse_str($parsedUrl['query'], $redisOptions);
104+
parse_str($parsedUrl['query'], $dsnOptions);
105+
$redisOptions = array_merge($redisOptions, $dsnOptions);
105106
}
106107

107108
$autoSetup = null;

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