Skip to content

[Mailer][Mime] In some areas header is not treated in a case-insensitive manner #39953

@piku235

Description

@piku235

Symfony version(s) affected: 5.2

Description
Recently, I've had a problem with a capitalized header when I tried to define a global sender in the framework config. The issue happens in the Headers::addHeader() when trying to resolve a header class from the header class map.

Also, Headers::isUniqueHeader() is affected and header rules in the MessageListener::addHeaderRule().

The feature pull request for reference.

How to reproduce
The following config leads to an exception in Headers::addHeader()

framework:
    mailer:
        headers:
            From: foo@localhost
TypeError(code: 0): Argument 2 passed to Symfony\\Component\\Mime\\Header\\Headers::addTextHeader() must be of the type string, array given

Possible Solution
The fix is simple, we need to ensure that strtolower() is used when doing something specific on a user-supplied header name.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions