bug #40062 [Mime] Fix case-sensitive handling of header names (piku235)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mime] Fix case-sensitive handling of header names

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #39953
| License       | MIT
| Doc PR        | -

Fixes case-sensitive handling of header names in "Mailer" component, more in the [ticket](https://github.com/symfony/symfony/issues/39953) and the [root PR](https://github.com/symfony/symfony/pull/39954).

Commits
-------

b2d7454042 [Mime] Fix case-sensitive handling in Headers::isUniqueHeader()
This commit is contained in:
Fabien Potencier 2021-02-02 07:09:05 +01:00
commit ccdcac2a3e
2 changed files with 6 additions and 1 deletions

View File

@ -201,7 +201,7 @@ final class Headers
public static function isUniqueHeader(string $name): bool
{
return \in_array($name, self::UNIQUE_HEADERS, true);
return \in_array(strtolower($name), self::UNIQUE_HEADERS, true);
}
public function toString(): string

View File

@ -212,6 +212,11 @@ class HeadersTest extends TestCase
$this->assertFalse($headers->has('Message-ID'));
}
public function testIsUniqueHeaderIsNotCaseSensitive()
{
$this->assertTrue(Headers::isUniqueHeader('From'));
}
public function testToStringJoinsHeadersTogether()
{
$headers = new Headers();