@@ -107,8 +107,7 @@ public function fromStrings(#[\SensitiveParameter] array $dsns): Transports
107
107
public function fromString (#[\SensitiveParameter] string $ dsn ): TransportInterface
108
108
{
109
109
[$ transport , $ offset ] = $ this ->parseDsn ($ dsn );
110
- $ dnsWithoutMainOptions = preg_replace ('/[?&]retry_period=\d+/ ' , '' , $ dsn );
111
- if ($ offset !== \strlen ($ dnsWithoutMainOptions )) {
110
+ if ($ offset !== \strlen ($ dsn )) {
112
111
throw new InvalidArgumentException ('The mailer DSN has some garbage at the end. ' );
113
112
}
114
113
@@ -122,10 +121,6 @@ private function parseDsn(#[\SensitiveParameter] string $dsn, int $offset = 0):
122
121
'roundrobin ' => RoundRobinTransport::class,
123
122
];
124
123
125
- $ parsedUrl = parse_url ($ dsn );
126
- parse_str ($ parsedUrl ['query ' ] ?? '' , $ query );
127
- $ retryPeriod = min ((int ) ($ query ['retry_period ' ] ?? 60 ), 60 );
128
-
129
124
while (true ) {
130
125
foreach ($ keywords as $ name => $ class ) {
131
126
$ name .= '( ' ;
@@ -150,7 +145,12 @@ private function parseDsn(#[\SensitiveParameter] string $dsn, int $offset = 0):
150
145
}
151
146
}
152
147
153
- return [new $ class ($ args , $ retryPeriod ), $ offset ];
148
+ parse_str (substr ($ dsn , $ offset + 1 ), $ query );
149
+ if ($ period = $ query ['retry_period ' ] ?? 0 ) {
150
+ return [new $ class ($ args , (int ) $ period ), $ offset + \strlen ('retry_period= ' .$ period ) + 1 ];
151
+ }
152
+
153
+ return [new $ class ($ args ), $ offset ];
154
154
}
155
155
}
156
156
0 commit comments