Skip to content

Commit a8934a6

Browse files
Merge branch '5.3' into 5.4
* 5.3: Fix tests [HttpKernel] skip test on appveyor [AMQP] [Messenger] Do not leak any credentials when connection fails
2 parents f82e811 + 7bf38ef commit a8934a6

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Tests/Transport/ConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@ public function testItDelaysTheMessageWithADifferentRoutingKeyAndTTLs()
559559
$connection->publish('{}', [], 120000);
560560
}
561561

562-
public function testObfuscatePasswordInDsn()
562+
public function testNoCredentialLeakageWhenConnectionFails()
563563
{
564564
$this->expectException(\AMQPException::class);
565-
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN. ({"host":"localhost","port":5672,"vhost":"/","login":"user","password":"********"})');
565+
$this->expectExceptionMessage('Could not connect to the AMQP server. Please verify the provided DSN.');
566566
$factory = new TestAmqpFactory(
567567
$amqpConnection = $this->createMock(\AMQPConnection::class),
568568
$amqpChannel = $this->createMock(\AMQPChannel::class),

Transport/Connection.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -495,11 +495,7 @@ public function channel(): \AMQPChannel
495495
try {
496496
$connection->{$connectMethod}();
497497
} catch (\AMQPConnectionException $e) {
498-
$credentials = $this->connectionOptions;
499-
$credentials['password'] = '********';
500-
unset($credentials['delay']);
501-
502-
throw new \AMQPException(sprintf('Could not connect to the AMQP server. Please verify the provided DSN. (%s).', json_encode($credentials, \JSON_UNESCAPED_SLASHES)), 0, $e);
498+
throw new \AMQPException('Could not connect to the AMQP server. Please verify the provided DSN.', 0, $e);
503499
}
504500
$this->amqpChannel = $this->amqpFactory->createChannel($connection);
505501

0 commit comments

Comments
 (0)