Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52ceda7

Browse files
alamiraultfabpot
authored andcommitted
[Mime] Fix missing sprintf in DkimSigner
1 parent6a5db15 commit52ceda7

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

‎src/Symfony/Component/Mime/Crypto/DkimSigner.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function sign(Message $message, array $options = []): Message
6565
{
6666
$options +=$this->defaultOptions;
6767
if (!\in_array($options['algorithm'], [self::ALGO_SHA256,self::ALGO_ED25519],true)) {
68-
thrownewInvalidArgumentException('Invalid DKIM signing algorithm "%s".',$options['algorithm']);
68+
thrownewInvalidArgumentException(sprintf('Invalid DKIM signing algorithm "%s".',$options['algorithm']));
6969
}
7070
$headersToIgnore['return-path'] =true;
7171
$headersToIgnore['x-transport'] =true;
@@ -205,7 +205,7 @@ private function hashBody(AbstractPart $body, string $bodyCanon, int $maxLength)
205205
}
206206

207207
// Add trailing Line return if last line is non empty
208-
if (\strlen($currentLine) >0) {
208+
if ('' !==$currentLine) {
209209
hash_update($hash,"\r\n");
210210
$length +=\strlen("\r\n");
211211
}

‎src/Symfony/Component/Mime/Tests/Crypto/DkimSignerTest.php‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
useSymfony\Component\Mime\Address;
1717
useSymfony\Component\Mime\Crypto\DkimSigner;
1818
useSymfony\Component\Mime\Email;
19+
useSymfony\Component\Mime\Message;
1920

2021
/**
2122
* @group time-sensitive
@@ -90,6 +91,21 @@ public function getSignData()
9091
];
9192
}
9293

94+
publicfunctiontestSignWithUnsupportedAlgorithm()
95+
{
96+
$message =$this->createMock(Message::class);
97+
98+
$signer =newDkimSigner(self::$pk,'testdkim.symfony.net','sf', [
99+
'algorithm' =>'unsupported-value',
100+
]);
101+
102+
$this->expectExceptionObject(
103+
new \LogicException('Invalid DKIM signing algorithm "unsupported-value".')
104+
);
105+
106+
$signer->sign($message, []);
107+
}
108+
93109
/**
94110
* @dataProvider getCanonicalizeHeaderData
95111
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp