Skip to content

Commit c061844

Browse files
committed
Convert all header keys to their lower case representation
1 parent 26e564f commit c061844

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
1616
- Syntax updated to support php 8 features
1717
- Get the attachment file extension from the filename if no mimetype detection library is available
1818
- Prevent the structure parsing from parsing an empty part
19+
- Convert all header keys to their lower case representation
1920

2021
### Added
2122
- Unit tests added #347 #242 (thanks @sergiy-petrov, @boekkooi-lengoo)

src/Header.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public function rfc822_parse_headers($raw_headers): object {
216216
if (extension_loaded('imap') && $this->config["rfc822"]) {
217217
$raw_imap_headers = (array)\imap_rfc822_parse_headers($raw_headers);
218218
foreach ($raw_imap_headers as $key => $values) {
219-
$key = str_replace("-", "_", $key);
219+
$key = strtolower(str_replace("-", "_", $key));
220220
$imap_headers[$key] = $values;
221221
}
222222
}
@@ -249,7 +249,7 @@ public function rfc822_parse_headers($raw_headers): object {
249249
} else {
250250
if (($pos = strpos($line, ":")) > 0) {
251251
$key = trim(rtrim(strtolower(substr($line, 0, $pos))));
252-
$key = str_replace("-", "_", $key);
252+
$key = strtolower(str_replace("-", "_", $key));
253253

254254
$value = trim(rtrim(substr($line, $pos + 1)));
255255
if (isset($headers[$key])) {

0 commit comments

Comments
 (0)