ZF-10074: Zend_Mime improperly quoted printable encodes lines with zeros at the end
Description
If you have a line which is one character longer than the limit that ends with "0", Zend_Mime::encodeQuotedPrintable() will strip the character due to implicit numerical conversion.
example line: "\t\t\t\tyour own goal! Use those 90 minutes being active yourself. A 90" quoted result with a 74 character limit: "=09=09=09=09your own goal! Use those 90 minutes being active yourself. A 9" expected result: "=09=09=09=09your own goal! Use those 90 minutes being active yourself. A 9= 0"
To fix this you need to do an explicit comparison in the while($str) loop:
- while ($str) {
+ while ($str != '') {
Comments
Posted by Steponas Dauginis (sk-lt) on 2011-05-24T12:44:59.000+0000
This is a major bug and it's still not fixed in trunk.
A test case:
The suggested fix by Chad works correctly.
Posted by Adam Lundrigan (adamlundrigan) on 2011-11-07T15:27:14.000+0000
Patch with fix + unit tests attached. Implemented unit test using provided test cases: * ZF-10074, by [~sk-lt] * ZF-11866, by [~interrobang]
Fix suggested by OP resolves the issue, and all unit tests in the {{Zend_Mime}} and {{Zend_Mail}} suites pass after patch is applied.
Unless there is a demonstrable case where this fix breaks backwards-compatibility, I recommend inclusion in next mini-release.
Posted by Adam Lundrigan (adamlundrigan) on 2012-05-12T19:13:05.000+0000
Fixed in trunk (1.12.0): r24797