Skip to content

Commit f1d82d9

Browse files
committed
Subject with colon ";" is truncated Webklex#401
1 parent 9f02c84 commit f1d82d9

File tree

4 files changed

+38
-1
lines changed

4 files changed

+38
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
1010
- Header value decoding improved #410
1111
- Protocol exception handling improved (bad response message added) #408
1212
- Prevent fetching singular rfc partials from running indefinitely #407
13+
- Subject with colon ";" is truncated #401
1314

1415
### Added
1516
- NaN

src/Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ private function extractHeaderExtensions(): void {
612612
$value = (string)$value;
613613
}
614614
// Only parse strings and don't parse any attributes like the user-agent
615-
if (($key == "user_agent") === false) {
615+
if (!in_array($key, ["user-agent", "subject"])) {
616616
if (($pos = strpos($value, ";")) !== false) {
617617
$original = substr($value, 0, $pos);
618618
$this->set($key, trim(rtrim($original)));

tests/issues/Issue401Test.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/*
3+
* File: Issue401Test.php
4+
* Category: Test
5+
* Author: M.Goldenbaum
6+
* Created: 23.06.23 22:48
7+
* Updated: -
8+
*
9+
* Description:
10+
* -
11+
*/
12+
13+
namespace Tests\issues;
14+
15+
use PHPUnit\Framework\TestCase;
16+
use Webklex\PHPIMAP\Message;
17+
18+
class Issue401Test extends TestCase {
19+
20+
public function testIssueEmail() {
21+
$filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-401.eml"]);
22+
$message = Message::fromFile($filename);
23+
24+
self::assertSame("1;00pm Client running few minutes late", (string)$message->subject);
25+
}
26+
27+
}

tests/messages/issue-401.eml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
Subject: 1;00pm Client running few minutes late
4+
Date: Wed, 13 Sep 2017 13:05:45 +0200
5+
Content-Type: text/plain;
6+
charset="us-ascii"
7+
Content-Transfer-Encoding: quoted-printable
8+
9+
Hi

0 commit comments

Comments
 (0)