Skip to content

Commit 7edbecf

Browse files
committed
Merge branch '4.4' into 5.1
* 4.4: Remove void return type from test methods Added basque translations Updated Luxembourgish translations [Mailer] Fix parsing Dsn with empty user/password Normalize exceptions messages containing methods references [Ldap] Incorrect determination of RelativeDistinguishedName for the "move" operation
2 parents a64adb2 + b6b6141 commit 7edbecf

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

Tests/Transport/DsnTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,26 @@ public function fromStringProvider(): iterable
5252
new Dsn('smtp', 'example.com'),
5353
];
5454

55+
yield 'simple dsn including @ sign, but no user/password/token' => [
56+
'scheme://@localhost',
57+
new Dsn('scheme', 'localhost', null, null),
58+
];
59+
60+
yield 'simple dsn including : sign and @ sign, but no user/password/token' => [
61+
'scheme://:@localhost',
62+
new Dsn('scheme', 'localhost', null, null),
63+
];
64+
65+
yield 'simple dsn including user, : sign and @ sign, but no password' => [
66+
'scheme://user1:@localhost',
67+
new Dsn('scheme', 'localhost', 'user1', null),
68+
];
69+
70+
yield 'simple dsn including : sign, password, and @ sign, but no user' => [
71+
'scheme://:pass@localhost',
72+
new Dsn('scheme', 'localhost', null, 'pass'),
73+
];
74+
5575
yield 'simple smtp with custom port' => [
5676
'smtp://user1:pass2@example.com:99',
5777
new Dsn('smtp', 'example.com', 'user1', 'pass2', 99),

Transport/Dsn.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public static function fromString(string $dsn): self
4949
throw new InvalidArgumentException(sprintf('The "%s" mailer DSN must contain a host (use "default" by default).', $dsn));
5050
}
5151

52-
$user = isset($parsedDsn['user']) ? urldecode($parsedDsn['user']) : null;
53-
$password = isset($parsedDsn['pass']) ? urldecode($parsedDsn['pass']) : null;
52+
$user = '' !== ($parsedDsn['user'] ?? '') ? urldecode($parsedDsn['user']) : null;
53+
$password = '' !== ($parsedDsn['pass'] ?? '') ? urldecode($parsedDsn['pass']) : null;
5454
$port = $parsedDsn['port'] ?? null;
5555
parse_str($parsedDsn['query'] ?? '', $query);
5656

0 commit comments

Comments
 (0)