Skip to content

Commit 3dac1d0

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 fc47953 + 951ac85 commit 3dac1d0

File tree

7 files changed

+11
-10
lines changed

7 files changed

+11
-10
lines changed

src/Symfony/Component/Cache/Adapter/AbstractAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static function ($key, $value, $isHit) {
5252
// Detect wrapped values that encode for their expiry and creation duration
5353
// For compactness, these values are packed in the key of an array using
5454
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
55-
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
55+
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) array_key_first($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
5656
$item->value = $v[$k];
5757
$v = unpack('Ve/Nc', substr($k, 1, -1));
5858
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;

src/Symfony/Component/Cache/Adapter/ApcuAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ protected function doSave(array $values, int $lifetime)
122122
} catch (\Throwable $e) {
123123
if (1 === \count($values)) {
124124
// Workaround https://github.com/krakjoe/apcu/issues/170
125-
apcu_delete(key($values));
125+
apcu_delete(array_key_first($values));
126126
}
127127

128128
throw $e;

src/Symfony/Component/Cache/Adapter/ProxyAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static function ($key, $innerItem, $poolHash) {
6363
// Detect wrapped values that encode for their expiry and creation duration
6464
// For compactness, these values are packed in the key of an array using
6565
// magic numbers in the form 9D-..-..-..-..-00-..-..-..-5F
66-
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) key($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
66+
if (\is_array($v) && 1 === \count($v) && 10 === \strlen($k = (string) array_key_first($v)) && "\x9D" === $k[0] && "\0" === $k[5] && "\x5F" === $k[9]) {
6767
$item->value = $v[$k];
6868
$v = unpack('Ve/Nc', substr($k, 1, -1));
6969
$item->metadata[CacheItem::METADATA_EXPIRY] = $v['e'] + CacheItem::METADATA_EXPIRY_OFFSET;

src/Symfony/Component/Cache/composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"psr/log": "^1.1|^2|^3",
2727
"symfony/cache-contracts": "^1.1.7|^2",
2828
"symfony/deprecation-contracts": "^2.1",
29+
"symfony/polyfill-php73": "^1.9",
2930
"symfony/polyfill-php80": "^1.16",
3031
"symfony/service-contracts": "^1.1|^2",
3132
"symfony/var-exporter": "^4.4|^5.0|^6.0"

src/Symfony/Component/HttpKernel/Tests/HttpKernelBrowserTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ public function testUploadedFileWhenNoFileSelected()
143143

144144
public function testUploadedFileWhenSizeExceedsUploadMaxFileSize()
145145
{
146+
if (UploadedFile::getMaxFilesize() > \PHP_INT_MAX) {
147+
$this->markTestSkipped('Requires PHP_INT_MAX to be greater than "upload_max_filesize" and "post_max_size" ini settings');
148+
}
149+
146150
$source = tempnam(sys_get_temp_dir(), 'source');
147151

148152
$kernel = new TestHttpKernel();

src/Symfony/Component/Messenger/Bridge/Amqp/Tests/Transport/ConnectionTest.php

+2-2
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),

src/Symfony/Component/Messenger/Bridge/Amqp/Transport/Connection.php

+1-5
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)