The line 566 wants to conform with the RFC 2822 in not allowing any lines being longer than 998 characters -- but fails.
There should be a TRUE as last paramter of wordwrap() for really breaking at 996 chars (see http://www.php.net/manual/en/function.wordwrap.php).
Therefore
// Break really long words at the maximum width allowed.
$line = wordwrap($line, 996 - $values['length'], $values['soft'] ? " \n" : "\n");
should become
// Break really long words at the maximum width allowed.
$line = wordwrap($line, 996 - $values['length'], $values['soft'] ? " \n" : "\n", TRUE);
Patch attached.
Cheers, Alex
Comments
Comment #1
alex-mo commentedComment #2
torotil commentedComment #3
sunLooks good.
Can you add a simple test for this case?
Should still apply cleanly to D8, D7, and D6 (give or take a /core directory).
Comment #4
torotil commentedWe already have DrupalHtmlToTextTestCase::testVeryLongLineWrap() which should cover this - but obviously hasn't.
Comment #5
jhedstromComment #6
rpayanmHere for drupal 8 :)
Comment #7
pwieck commentedComment #8
Anonymous (not verified) commentedI corrected the test as suggested in #4, but it does not fail. If I check the output text in the test, it seems to be wrapped correctly.
Could someone provide a failing example text?
Comment #10
Anonymous (not verified) commentedThis did not fail on my local installation, but did fail on the test bot. Could this be related to php version? My local version is php 5.4.34.
New patches are the combination of #6 and #8.
Comment #12
geertvd commentedThis fails on my local installation. I think this is good to go.
Comment #13
alexpottThis issue is a normal bug fix, and doesn't include any disruptive changes, so it is allowed per https://www.drupal.org/core/beta-changes. Committed 0ed1f2e and pushed to 8.0.x. Thanks!
Minor fix on commit.
Comment #15
Anonymous (not verified) commentedBackport for D7.
Comment #17
izmeez commentedI don't think this has been committed to Drupal 7 based on the commit references in comments #14 and #16.
Changing status of patch for Drupal 7 to RTBC since the patch in #15 for D7 is the same as that committed to D8.
Comment #18
David_Rothstein commentedCommitted to 7.x - thanks!
This issue has the "needs backport to D6" tag, but I'm guessing that's not happening at this point. Feel free to reopen for Drupal 6 if you want to try :)
Comment #20
maximpodorov commentedThis is incorrect anyway, since wordwrap() can't deal with utf-8 (and mail bodies can be in utf-8!).
See https://www.drupal.org/node/364670 for more accurate solution.