Skip to content

Commit 1af223d

Browse files
committed
fix
1 parent 728bf1c commit 1af223d

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎pkg/dsn/Dsn.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ public static function parse(string $dsn): array
250250
list($hostsPorts) = explode('#', $dsnWithoutUserPassword, 2);
251251
list($hostsPorts) = explode('?', $hostsPorts, 2);
252252
list($hostsPorts) = explode('/', $hostsPorts, 2);
253-
} else {
253+
}
254+
255+
if (empty($hostsPorts)) {
254256
return [
255257
new self(
256258
$scheme,

‎pkg/dsn/Tests/DsnTest.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ public function testShouldParseQueryParameterAsFloat(string $parameter, float $e
180180
$this->assertSame($expected, $dsn->getFloat('aName'));
181181
}
182182

183+
public function testShouldParseDSNWithoutAuthorityPart()
184+
{
185+
$dsn = Dsn::parseFirst('foo:///foo');
186+
187+
$this->assertNull($dsn->getUser());
188+
$this->assertNull($dsn->getPassword());
189+
$this->assertNull($dsn->getHost());
190+
$this->assertNull($dsn->getPort());
191+
}
192+
183193
public function testShouldReturnDefaultFloatIfNotSet()
184194
{
185195
$dsn = Dsn::parseFirst('foo:');

‎pkg/stomp/StompConnectionFactory.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private function parseDsn(string $dsn): array
100100
$dsn = Dsn::parseFirst($dsn);
101101

102102
if ('stomp' !== $dsn->getSchemeProtocol()) {
103-
throw new \LogicException(sprintf('The given DSN "%s" is not supported. Must start with "stomp:".', $dsn));
103+
throw new \LogicException(sprintf('The given DSN is not supported. Must start with "stomp:".'));
104104
}
105105

106106
return array_filter(array_replace($dsn->getQuery(), [

0 commit comments

Comments
 (0)