Skip to content

Releases

2.3.0

Choose a tag to compare

@rcambien rcambien released this 05 Nov 15:15
abec534

Security

  • Fix a denial of service with crafted multipart content (GHSA-wvq4-f5wr-7hj4). Adjacent boundaries copied the rest of the stream for each of them, and the number of parts, the nesting depth and the cost of header parsing were not bounded: a few KB of input could use hundreds of MB of memory and seconds of CPU. Upgrading is recommended for any application parsing untrusted multipart content.
  • New limits: 1000 parts per content, nested parts included, and 16 nesting levels, configurable with StreamedPart::setMaxParts() and StreamedPart::setMaxDepth() (null for no limit). Above them, a LimitExceededException (a \LogicException) is thrown. At most 100 options are parsed per header.

Fixes

  • Raw UTF-8 in headers, such as non-ASCII field and file names sent by browsers, is no longer replaced with ? (#62)
  • Binary parts with a base64 or quoted-printable encoding and no charset are no longer corrupted by charset detection
  • An unsupported charset no longer throws a ValueError on PHP 8
  • Semicolons inside quoted header options no longer split them (#64)
  • Header option names are looked up case-insensitively, filename* takes precedence over filename, and RFC 2231 continuations are supported
  • Underscores in Q encoded-words are decoded as spaces on PHP < 8.3

Behaviour changes

  • Header values are always returned as valid UTF-8
  • Non-text parts without a declared charset are returned as is, without charset detection
  • \" is unescaped in quoted header options
  • getHeaderValue() and getMimeType() are trimmed
  • Malformed headers, common in emails, are parsed as before

Credits

Thanks to @aran112000 for #62, #64 and for reporting GHSA-wvq4-f5wr-7hj4.

2.2.2

Choose a tag to compare

@rcambien rcambien released this 15 Jan 11:09
fadbb1c

What's Changed

  • Fix PHP 8.4 TypeError: strtolower() null argument when Content-Type header missing by @Copilot in #60

New Contributors

  • @Copilot made their first contribution in #60

Full Changelog: 2.2.1...2.2.2

2.2.1

Choose a tag to compare

@rcambien rcambien released this 07 Jan 12:31
67937af
  • Fix binary data detection for PHP >= 8.3
  • Add PHP 8.5 to test suite

2.2.0

Choose a tag to compare

@rcambien rcambien released this 29 Apr 08:41
1410f23

Change the default encoding when Content-Transfer-Encoding header is missing to binary 7bit (as recommended by RFC 2388 and RFC 2045) to disable the charset detection and conversion to UTF-8 that may break binary content.

⚠️ May be a breaking change

2.1.2

Choose a tag to compare

@rcambien rcambien released this 12 Mar 16:47
7a9f464

What's Changed

  • Add strict mode to check for malformed headers (long strings) by @mnapoli in #50

Full Changelog: 2.1.1...2.1.2

2.1.1

Choose a tag to compare

@rcambien rcambien released this 28 Apr 18:55
2418bdf
fix: Make "isMultiPart" method case-insensitive (#49)

2.1.0: Remove parameter EOLCharacterLength and detect it automatically (#46)

Choose a tag to compare

@rcambien rcambien released this 28 Apr 18:55
68e5499
* Change behavior of testNoNewLineAtTheEndOfThePartsWhenNewLineIsOneCharacterLong to not specify EOLCharacterLength

* Remove parameter EOLCharacterLength and detect it automatically