Skip to content

Commit

Permalink
Merge branch '7.1' into 7.2
Browse files Browse the repository at this point in the history
* 7.1:
  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
  [Notifier] Improve Telegrams markdown escaping
  [Validator] [Choice] Fix callback option if not array returned
  [DependencyInjection] Fix linting factories implemented via __callStatic
  [DependencyInjection] Fix replacing abstract arguments with bindings
  [DependencyInjection] Fix parsing nested AutowireInline attributes
  Minor fixes around parse_url() checks
  Ensure compatibility with mongodb v2
  Add missing translations for Turkish (tr)
  • Loading branch information
nicolas-grekas committed Oct 25, 2024
2 parents ee8c613 + caa1e52 commit e57faea
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Header/AbstractHeader.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,20 @@ protected function getEncodableWordTokens(string $string): array
$tokens[] = $encodedToken;
}

foreach ($tokens as $i => $token) {
// whitespace(s) between 2 encoded tokens
if (
0 < $i
&& isset($tokens[$i + 1])
&& preg_match('~^[\t ]+$~', $token)
&& $this->tokenNeedsEncoding($tokens[$i - 1])
&& $this->tokenNeedsEncoding($tokens[$i + 1])
) {
$tokens[$i - 1] .= $token.$tokens[$i + 1];
array_splice($tokens, $i, 2);
}
}

return $tokens;
}

Expand Down
8 changes: 8 additions & 0 deletions Tests/Header/MailboxHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ public function testUtf8CharsInLocalPart()
{
$header = new MailboxHeader('Sender', new Address('fabïen@symfony.com'));
$this->assertSame('fabïen@symfony.com', $header->getBodyAsString());

// name with single space
$header = new MailboxHeader('Sender', new Address('fabïen@symfony.com', 'Fabïen Pötencier'));
$this->assertSame('=?utf-8?Q?Fab=C3=AFen_P=C3=B6tencier?= <fabïen@symfony.com>', $header->getBodyAsString());

// name with double spaces
$header = new MailboxHeader('Sender', new Address('fabïen@symfony.com', 'Fabïen Pötencier'));
$this->assertSame('=?utf-8?Q?Fab=C3=AFen__P=C3=B6tencier?= <fabïen@symfony.com>', $header->getBodyAsString());
}

public function testToString()
Expand Down

0 comments on commit e57faea

Please sign in to comment.