Skip to content

Exception thrown if content-type has line breaks #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
skurrilewelt opened this issue Apr 3, 2025 · 0 comments
Open

Exception thrown if content-type has line breaks #569

skurrilewelt opened this issue Apr 3, 2025 · 0 comments
Labels
bug Something isn't working More information required Further information is requested validating

Comments

@skurrilewelt
Copy link

I stumbled over emails with following headers:

more headers above
X-Mailer: xxx-xxxx-4.5.347
Content-Type: multipart/alternative; boundary=
        "=_7712c5e3690ec5b8367846b5=4dbc0b8a-a13f-5411-81ce-67cd64fd9617_="
Received-SPF: pass (1216.central...

When parsing this headers boundary is empty string and the message could not be loaded, furthermore an error will be thrown.

A possible fix can be in Header.php:

public function find($pattern): mixed {
    if (preg_match_all($pattern, str_replace("\r\n", " ", $this->raw), $matches)) {
        if (isset($matches[1])) {
            if (count($matches[1]) > 0) {
                return $matches[1][0];
            }
        }
    }
    return null;
}

Now boundary has the expected content. I can't see any usages of this method except in Header::getBoundary().

Im using the newest 5.x version.

@Webklex Webklex added bug Something isn't working validating More information required Further information is requested labels Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working More information required Further information is requested validating
Projects
None yet
Development

No branches or pull requests

2 participants