Skip to content

Commit 1de1cf1

Browse files
Merge branch '5.4' into 6.4
* 5.4: initialize RedisAdapter cursor to 0 do not skip tests from data providers ensure compatibility with Twig 3.15 [Mime] fix encoding issue with UTF-8 addresses containing doubles spaces fix translation file syntax [Validator] [Choice] Fix callback option if not array returned [DependencyInjection] Fix linting factories implemented via __callStatic [DependencyInjection] Fix replacing abstract arguments with bindings Minor fixes around parse_url() checks Ensure compatibility with mongodb v2 Add missing translations for Turkish (tr)
2 parents 108ffe3 + 8c1b9b3 commit 1de1cf1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Header/AbstractHeader.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,20 @@ protected function getEncodableWordTokens(string $string): array
188188
$tokens[] = $encodedToken;
189189
}
190190

191+
foreach ($tokens as $i => $token) {
192+
// whitespace(s) between 2 encoded tokens
193+
if (
194+
0 < $i
195+
&& isset($tokens[$i + 1])
196+
&& preg_match('~^[\t ]+$~', $token)
197+
&& $this->tokenNeedsEncoding($tokens[$i - 1])
198+
&& $this->tokenNeedsEncoding($tokens[$i + 1])
199+
) {
200+
$tokens[$i - 1] .= $token.$tokens[$i + 1];
201+
array_splice($tokens, $i, 2);
202+
}
203+
}
204+
191205
return $tokens;
192206
}
193207

Tests/Header/MailboxHeaderTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ public function testUtf8CharsInLocalPart()
6262
{
6363
$header = new MailboxHeader('Sender', new Address('fabï[email protected]'));
6464
$this->assertSame('fabï[email protected]', $header->getBodyAsString());
65+
66+
// name with single space
67+
$header = new MailboxHeader('Sender', new Address('fabï[email protected]', 'Fabïen Pötencier'));
68+
$this->assertSame('=?utf-8?Q?Fab=C3=AFen_P=C3=B6tencier?= <fabï[email protected]>', $header->getBodyAsString());
69+
70+
// name with double spaces
71+
$header = new MailboxHeader('Sender', new Address('fabï[email protected]', 'Fabïen Pötencier'));
72+
$this->assertSame('=?utf-8?Q?Fab=C3=AFen__P=C3=B6tencier?= <fabï[email protected]>', $header->getBodyAsString());
6573
}
6674

6775
public function testToString()

0 commit comments

Comments
 (0)