Skip to content

Commit

Permalink
[mms] Fix accessing subparts when using Horde_Mime_Part#getRawPartTex…
Browse files Browse the repository at this point in the history
…t().
  • Loading branch information
slusarz committed Nov 11, 2014
1 parent 2732f1d commit 21bdd9d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/Mime/lib/Horde/Mime/Part.php
Expand Up @@ -2168,8 +2168,8 @@ public static function getRawPartText($text, $type, $id)
$orig_id = $id;

if ($base_pos !== false) {
$base_pos = substr($id, 0, $base_pos);
$id = substr($id, $base_pos);
$id = substr($id, $base_pos + 1);
$base_pos = substr($orig_id, 0, $base_pos);
} else {
$base_pos = $id;
$id = 0;
Expand Down
15 changes: 15 additions & 0 deletions framework/Mime/test/Horde/Mime/PartTest.php
Expand Up @@ -488,6 +488,21 @@ public function testMimeMessageWithNoContentType()
);
}

public function testAccessingMimePartsInRawText()
{
$msg = file_get_contents(__DIR__ . '/fixtures/samplemultipart_msg.txt');

$this->assertNotEmpty(
Horde_Mime_Part::getRawPartText($msg, 'body', '0')
);
$this->assertNotEmpty(
Horde_Mime_Part::getRawPartText($msg, 'body', '1')
);
$this->assertNotEmpty(
Horde_Mime_Part::getRawPartText($msg, 'body', '2')
);
}

protected function _getTestPart()
{
$part = new Horde_Mime_Part();
Expand Down

0 comments on commit 21bdd9d

Please sign in to comment.