--- ./vendor/zetacomponents/mail/src/internal/header_folder.php.orig 2014-05-15 10:02:17.357559469 +0200 +++ ./vendor/zetacomponents/mail/src/internal/header_folder.php 2014-05-15 10:10:52.469552994 +0200 @@ -100,7 +100,7 @@ * @param string $text * @return string */ - static public function foldAny( $text ) + static private function foldAnyLinePart( $text ) { // Don't fold unless we have to. if ( strlen( $text ) <= self::$limit ) @@ -158,5 +158,32 @@ } return $folded; } + + /** + * Returns $text folded to the 998 character limit on any whitespace. + * + * Checks first if the text is shorter than max length for a line. + * + * @param string $text + * @return string + */ + static public function foldAny( $text ) + { + if ( strlen( $text ) <= self::$limit ) + { + return $text; + } + + $foldedTextList = array(); + + $list = explode( ezcMailTools::lineBreak(), $text ); + foreach ( $list as $textPart ) + { + $foldedTextList[] = self::foldAnyLinePart( $textPart ); + } + $value = implode( ezcMailTools::lineBreak(), $foldedTextList ); + + return $value; + } } ?>