@@ -177,24 +177,24 @@ public function __construct(array $connectionOptions, array $exchangeOptions, ar
177
177
*/
178
178
public static function fromDsn (string $ dsn , array $ options = [], AmqpFactory $ amqpFactory = null ): self
179
179
{
180
- if (false === $ parsedUrl = parse_url ($ dsn )) {
180
+ if (false === $ params = parse_url ($ dsn )) {
181
181
// this is a valid URI that parse_url cannot handle when you want to pass all parameters as options
182
182
if (!\in_array ($ dsn , ['amqp:// ' , 'amqps:// ' ])) {
183
183
throw new InvalidArgumentException ('The given AMQP DSN is invalid. ' );
184
184
}
185
185
186
- $ parsedUrl = [];
186
+ $ params = [];
187
187
}
188
188
189
189
$ useAmqps = 0 === strpos ($ dsn , 'amqps:// ' );
190
- $ pathParts = isset ($ parsedUrl ['path ' ]) ? explode ('/ ' , trim ($ parsedUrl ['path ' ], '/ ' )) : [];
190
+ $ pathParts = isset ($ params ['path ' ]) ? explode ('/ ' , trim ($ params ['path ' ], '/ ' )) : [];
191
191
$ exchangeName = $ pathParts [1 ] ?? 'messages ' ;
192
- parse_str ($ parsedUrl ['query ' ] ?? '' , $ parsedQuery );
192
+ parse_str ($ params ['query ' ] ?? '' , $ parsedQuery );
193
193
$ port = $ useAmqps ? 5671 : 5672 ;
194
194
195
195
$ amqpOptions = array_replace_recursive ([
196
- 'host ' => $ parsedUrl ['host ' ] ?? 'localhost ' ,
197
- 'port ' => $ parsedUrl ['port ' ] ?? $ port ,
196
+ 'host ' => $ params ['host ' ] ?? 'localhost ' ,
197
+ 'port ' => $ params ['port ' ] ?? $ port ,
198
198
'vhost ' => isset ($ pathParts [0 ]) ? urldecode ($ pathParts [0 ]) : '/ ' ,
199
199
'exchange ' => [
200
200
'name ' => $ exchangeName ,
@@ -203,12 +203,12 @@ public static function fromDsn(string $dsn, array $options = [], AmqpFactory $am
203
203
204
204
self ::validateOptions ($ amqpOptions );
205
205
206
- if (isset ($ parsedUrl ['user ' ])) {
207
- $ amqpOptions ['login ' ] = urldecode ( $ parsedUrl ['user ' ]);
206
+ if (isset ($ params ['user ' ])) {
207
+ $ amqpOptions ['login ' ] = rawurldecode ( $ params ['user ' ]);
208
208
}
209
209
210
- if (isset ($ parsedUrl ['pass ' ])) {
211
- $ amqpOptions ['password ' ] = urldecode ( $ parsedUrl ['pass ' ]);
210
+ if (isset ($ params ['pass ' ])) {
211
+ $ amqpOptions ['password ' ] = rawurldecode ( $ params ['pass ' ]);
212
212
}
213
213
214
214
if (!isset ($ amqpOptions ['queues ' ])) {
0 commit comments