Index: library/Zend/Mime.php =================================================================== --- library/Zend/Mime.php (revision 24554) +++ library/Zend/Mime.php (working copy) @@ -130,7 +130,7 @@ $str = self::_encodeQuotedPrintable($str); // Split encoded text into separate lines - while ($str) { + while(strlen($str) > 0) { $ptr = strlen($str); if ($ptr > $lineLength) { $ptr = $lineLength; Index: tests/Zend/MimeTest.php =================================================================== --- tests/Zend/MimeTest.php (revision 24554) +++ tests/Zend/MimeTest.php (working copy) @@ -73,6 +73,17 @@ $this->assertEquals(quoted_printable_decode($qp), $text); } + /** + * @group ZF-10074 + */ + public function testEncodeQuotedPrintableWhenTextHasZeroAtTheEnd() + { + $raw = str_repeat('x',72) . '0'; + $quoted = Zend_Mime::encodeQuotedPrintable($raw, 72); + $expected = quoted_printable_decode($quoted); + $this->assertEquals($expected, $raw); + } + public function testBase64() { $content = str_repeat("\x88\xAA\xAF\xBF\x29\x88\xAA\xAF\xBF\x29\x88\xAA\xAF", 4);