Skip to content

Commit 9e77f6d

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: (31 commits) fix test Clarify goals of AbstractController cs fix [Security][Validator] Add missing translations for Indonesian (id) [Security] Deprecate legacy signatures [Notifier] fix typo firebase [SecurityBundle] Create a smooth upgrade path for security factories Add trailing Line return if last line is non empty Add trailing Line return if last line is non empty [Security] Deprecate `PassportInterface` Report mismatches between trans-unit id and source text via status script Do not add namespace argument to NullAdapter in CachePoolPass [FrameworkBundle] Update cache:clear help [HttpFoundation] Add `litespeed_finish_request` to `Response` Fix markup (minor) remove author tags from test classes [Notifier] add `SentMessageEvent` and `FailedMessageEvent` [HttpFoundation] Mark Request::get() internal Add missing to semi-colon to exception.js [FrameworkBundle] remove dead conditions in Translation Commands ...
2 parents 27a0fd5 + 17f7540 commit 9e77f6d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

Crypto/DkimSigner.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,13 @@ private function hashBody(AbstractPart $body, string $bodyCanon, int $maxLength)
203203
hash_update($hash, $canon);
204204
}
205205

206-
if (0 === $length) {
206+
// Add trailing Line return if last line is non empty
207+
if (\strlen($currentLine) > 0) {
208+
hash_update($hash, "\r\n");
209+
$length += \strlen("\r\n");
210+
}
211+
212+
if (!$relaxed && 0 === $length) {
207213
hash_update($hash, "\r\n");
208214
$length = 2;
209215
}

Tests/Crypto/DkimSignerTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ public function getCanonicalizeHeaderData()
122122
DkimSigner::CANON_SIMPLE, "\r\n", '', \PHP_INT_MAX,
123123
];
124124
yield 'relaxed_empty' => [
125-
DkimSigner::CANON_RELAXED, "\r\n", '', \PHP_INT_MAX,
125+
DkimSigner::CANON_RELAXED, '', '', \PHP_INT_MAX,
126126
];
127127

128128
yield 'simple_empty_single_ending_CLRF' => [
129129
DkimSigner::CANON_SIMPLE, "\r\n", "\r\n", \PHP_INT_MAX,
130130
];
131131
yield 'relaxed_empty_single_ending_CLRF' => [
132-
DkimSigner::CANON_RELAXED, "\r\n", "\r\n", \PHP_INT_MAX,
132+
DkimSigner::CANON_RELAXED, '', "\r\n", \PHP_INT_MAX,
133133
];
134134

135135
yield 'simple_multiple_ending_CLRF' => [

0 commit comments

Comments
 (0)