diff -Nru libphp-swiftmailer-5.4.1/CHANGES libphp-swiftmailer-5.4.2/CHANGES --- libphp-swiftmailer-5.4.1/CHANGES 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/CHANGES 2016-05-01 08:45:47.000000000 +0000 @@ -1,6 +1,21 @@ Changelog ========= +5.4.2 (2016-05-01) +------------------ + + * fixed support for IPv6 sockets + * added auto-retry when sending messages from the memory spool + * fixed consecutive read calls in Swift_ByteStream_FileByteStream + * added support for iso-8859-15 encoding + * fixed PHP mail extra params on missing reversePath + * added methods to set custom stream context options + * fixed charset changes in QpContentEncoderProxy + * added return-path header to the ignoredHeaders list of DKIMSigner + * fixed crlf for subject using mail + * fixed add soft line break only when necessary + * fixed escaping command-line args to Sendmail + 5.4.1 (2015-06-06) ------------------ diff -Nru libphp-swiftmailer-5.4.1/composer.json libphp-swiftmailer-5.4.2/composer.json --- libphp-swiftmailer-5.4.1/composer.json 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/composer.json 2016-05-01 08:45:47.000000000 +0000 @@ -23,6 +23,11 @@ "autoload": { "files": ["lib/swift_required.php"] }, + "autoload-dev": { + "psr-0": { + "Swift_": "tests/unit" + } + }, "extra": { "branch-alias": { "dev-master": "5.4-dev" diff -Nru libphp-swiftmailer-5.4.1/debian/changelog libphp-swiftmailer-5.4.2/debian/changelog --- libphp-swiftmailer-5.4.1/debian/changelog 2016-02-19 09:43:20.000000000 +0000 +++ libphp-swiftmailer-5.4.2/debian/changelog 2016-06-10 14:26:56.000000000 +0000 @@ -1,9 +1,12 @@ -libphp-swiftmailer (5.4.1-1ubuntu1) xenial; urgency=medium +libphp-swiftmailer (5.4.2-1) unstable; urgency=medium - * debian/control: update to generic PHP dependencies. - * LP: #1543723. + * Imported Upstream version 5.4.2 + * Improve watch file + * Update Standards-Version (no changes needed) + * Prepare for php7.0 transition (Closes: 821617) + * Ensure swiftmailer_generate_mimes_config.php is not executable - -- Nishanth Aravamudan Fri, 22 Jan 2016 12:07:17 -0800 + -- Jeremy T. Bouse Fri, 10 Jun 2016 10:26:42 -0400 libphp-swiftmailer (5.4.1-1) unstable; urgency=medium diff -Nru libphp-swiftmailer-5.4.1/debian/control libphp-swiftmailer-5.4.2/debian/control --- libphp-swiftmailer-5.4.1/debian/control 2016-02-19 09:43:20.000000000 +0000 +++ libphp-swiftmailer-5.4.2/debian/control 2016-06-10 13:49:35.000000000 +0000 @@ -1,20 +1,22 @@ Source: libphp-swiftmailer Section: php Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Nicolas Roudaire +Maintainer: Nicolas Roudaire Uploaders: Jeremy T. Bouse Build-Depends: debhelper (>> 9.0.0), - pkg-php-tools (>= 1.32~) -Standards-Version: 3.9.6 + pkg-php-tools (>= 1.7~) +Standards-Version: 3.9.8 Homepage: http://swiftmailer.org/ -Vcs-Git: git://github.com/jbouse-debian/php-swiftmailer.git +Vcs-Git: https://github.com/jbouse-debian/php-swiftmailer.git Vcs-Browser: https://github.com/jbouse-debian/php-swiftmailer Package: php-swiftmailer Architecture: all -Depends: ${misc:Depends}, php-cli, ${phpcomposer:Debian-require} -Suggests: php, ${phpcomposer:Debian-suggests} +Depends: php-cli, + ${misc:Depends}, + ${phpcomposer:Debian-require} +Suggests: libapache2-mod-php | php, + ${phpcomposer:Debian-suggests} Replaces: libphp-swiftmailer (<<5.1.0-1~) Breaks: libphp-swiftmailer (<<5.1.0-1~) Provides: libphp-swiftmailer @@ -31,8 +33,8 @@ - large attachments and inline/embedded images with low memory use Package: libphp-swiftmailer -Depends: ${misc:Depends}, php-swiftmailer +Depends: php-swiftmailer, + ${misc:Depends} Architecture: all -Section: oldlibs Description: transitional dummy package This is a transitional dummy package. It can safely be removed. diff -Nru libphp-swiftmailer-5.4.1/debian/copyright libphp-swiftmailer-5.4.2/debian/copyright --- libphp-swiftmailer-5.4.1/debian/copyright 2015-07-08 13:48:01.000000000 +0000 +++ libphp-swiftmailer-5.4.2/debian/copyright 2016-06-10 13:43:04.000000000 +0000 @@ -4,7 +4,7 @@ Files: * Copyright: 2004-2009 Chris Corbyn http://swiftmailer.org/ - 2009-2013 Fabien Potencier + 2009-2013 Fabien Potencier License: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -41,6 +41,6 @@ along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . - On Debian systems, the complete text of the GNU General Public License + On Debian systems, the complete text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. diff -Nru libphp-swiftmailer-5.4.1/debian/php-swiftmailer.lintian-overrides libphp-swiftmailer-5.4.2/debian/php-swiftmailer.lintian-overrides --- libphp-swiftmailer-5.4.1/debian/php-swiftmailer.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ libphp-swiftmailer-5.4.2/debian/php-swiftmailer.lintian-overrides 2016-06-10 14:17:37.000000000 +0000 @@ -0,0 +1 @@ +php-swiftmailer: script-not-executable usr/share/php/Swift/swiftmailer_generate_mimes_config.php diff -Nru libphp-swiftmailer-5.4.1/debian/rules libphp-swiftmailer-5.4.2/debian/rules --- libphp-swiftmailer-5.4.1/debian/rules 2015-07-08 13:48:01.000000000 +0000 +++ libphp-swiftmailer-5.4.2/debian/rules 2016-06-10 14:17:53.000000000 +0000 @@ -11,3 +11,8 @@ %: dh $@ --with phpcomposer + +override_dh_fixperms: + dh_fixperms -- + + find debian/php-swiftmailer/usr/share/php/Swift -type f -print0 | xargs -r0 chmod -x ; diff -Nru libphp-swiftmailer-5.4.1/debian/watch libphp-swiftmailer-5.4.2/debian/watch --- libphp-swiftmailer-5.4.1/debian/watch 2015-07-08 13:48:01.000000000 +0000 +++ libphp-swiftmailer-5.4.2/debian/watch 2016-06-10 03:49:22.000000000 +0000 @@ -1,2 +1,3 @@ version=3 -https://github.com/swiftmailer/swiftmailer/tags .*/archive/v(\d[\d\.]*).tar.gz +opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/libphp-swiftmailer-$1\.tar\.gz/ \ + https://github.com/swiftmailer/swiftmailer/releases .*/v?(\d\S*)\.tar\.gz diff -Nru libphp-swiftmailer-5.4.1/doc/overview.rst libphp-swiftmailer-5.4.2/doc/overview.rst --- libphp-swiftmailer-5.4.1/doc/overview.rst 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/doc/overview.rst 2016-05-01 08:45:47.000000000 +0000 @@ -21,11 +21,11 @@ The basic requirements to operate Swift Mailer are extremely minimal and easily achieved. Historically, Swift Mailer has supported both PHP 4 and PHP 5 by following a parallel development workflow. Now in it's fourth major -version, and Swift Mailer operates on servers running PHP 5.2 or higher. +version, and Swift Mailer operates on servers running PHP 5.3.3 or higher. The library aims to work with as many PHP 5 projects as possible: -* PHP 5.2 or higher, with the SPL extension (standard) +* PHP 5.3.3 or higher, with the SPL extension (standard) * Limited network access to connect to remote SMTP servers diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php libphp-swiftmailer-5.4.2/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php 2016-05-01 08:45:47.000000000 +0000 @@ -22,6 +22,8 @@ /** * StreamFilters. + * + * @var Swift_StreamFilter[] */ private $_filters = array(); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/ByteStream/ArrayByteStream.php libphp-swiftmailer-5.4.2/lib/classes/Swift/ByteStream/ArrayByteStream.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/ByteStream/ArrayByteStream.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/ByteStream/ArrayByteStream.php 2016-05-01 08:45:47.000000000 +0000 @@ -82,9 +82,7 @@ // Don't use array slice $end = $length + $this->_offset; - $end = $this->_arraySize < $end - ? $this->_arraySize - : $end; + $end = $this->_arraySize < $end ? $this->_arraySize : $end; $ret = ''; for (; $this->_offset < $end; ++$this->_offset) { $ret .= $this->_array[$this->_offset]; diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/ByteStream/FileByteStream.php libphp-swiftmailer-5.4.2/lib/classes/Swift/ByteStream/FileByteStream.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/ByteStream/FileByteStream.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/ByteStream/FileByteStream.php 2016-05-01 08:45:47.000000000 +0000 @@ -139,11 +139,13 @@ private function _getReadHandle() { if (!isset($this->_reader)) { - if (!$this->_reader = fopen($this->_path, 'rb')) { + $pointer = @fopen($this->_path, 'rb'); + if (!$pointer) { throw new Swift_IoException( 'Unable to open file for reading ['.$this->_path.']' ); } + $this->_reader = $pointer; if ($this->_offset != 0) { $this->_getReadStreamSeekableStatus(); $this->_seekReadStreamToPosition($this->_offset); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterReader/GenericFixedWidthReader.php 2016-05-01 08:45:47.000000000 +0000 @@ -82,7 +82,7 @@ { $needed = $this->_width - $size; - return ($needed > -1) ? $needed : -1; + return $needed > -1 ? $needed : -1; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterReader/UsAsciiReader.php libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterReader/UsAsciiReader.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterReader/UsAsciiReader.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterReader/UsAsciiReader.php 2016-05-01 08:45:47.000000000 +0000 @@ -67,9 +67,9 @@ $byte = reset($bytes); if (1 == count($bytes) && $byte >= 0x00 && $byte <= 0x7F) { return 0; - } else { - return -1; } + + return -1; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterReader/Utf8Reader.php libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterReader/Utf8Reader.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterReader/Utf8Reader.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterReader/Utf8Reader.php 2016-05-01 08:45:47.000000000 +0000 @@ -161,10 +161,7 @@ } $needed = self::$length_map[$bytes[0]] - $size; - return ($needed > -1) - ? $needed - : -1 - ; + return $needed > -1 ? $needed : -1; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterStream/NgCharacterStream.php libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterStream/NgCharacterStream.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/CharacterStream/NgCharacterStream.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/CharacterStream/NgCharacterStream.php 2016-05-01 08:45:47.000000000 +0000 @@ -165,9 +165,7 @@ return false; } $ret = false; - $length = ($this->_currentPos + $length > $this->_charCount) - ? $this->_charCount - $this->_currentPos - : $length; + $length = $this->_currentPos + $length > $this->_charCount ? $this->_charCount - $this->_currentPos : $length; switch ($this->_mapType) { case Swift_CharacterReader::MAP_TYPE_FIXED_LEN: $len = $length * $this->_map; @@ -178,10 +176,6 @@ break; case Swift_CharacterReader::MAP_TYPE_INVALID: - $end = $this->_currentPos + $length; - $end = $end > $this->_charCount - ? $this->_charCount - : $end; $ret = ''; for (; $this->_currentPos < $length; ++$this->_currentPos) { if (isset($this->_map[$this->_currentPos])) { @@ -194,9 +188,7 @@ case Swift_CharacterReader::MAP_TYPE_POSITIONS: $end = $this->_currentPos + $length; - $end = $end > $this->_charCount - ? $this->_charCount - : $end; + $end = $end > $this->_charCount ? $this->_charCount : $end; $ret = ''; $start = 0; if ($this->_currentPos > 0) { diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/DependencyContainer.php libphp-swiftmailer-5.4.2/lib/classes/Swift/DependencyContainer.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/DependencyContainer.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/DependencyContainer.php 2016-05-01 08:45:47.000000000 +0000 @@ -311,9 +311,9 @@ return $reflector->newInstanceArgs( $this->createDependenciesFor($itemName) ); - } else { - return $reflector->newInstance(); } + + return $reflector->newInstance(); } /** Create and register a shared instance of $itemName */ @@ -366,8 +366,8 @@ } return $collection; - } else { - return $this->lookup($item); } + + return $this->lookup($item); } } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Encoder/QpEncoder.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Encoder/QpEncoder.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Encoder/QpEncoder.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Encoder/QpEncoder.php 2016-05-01 08:45:47.000000000 +0000 @@ -198,14 +198,25 @@ } $enc = $this->_encodeByteSequence($bytes, $size); - if ($currentLine && $lineLen + $size >= $thisLineLength) { + + $i = strpos($enc, '=0D=0A'); + $newLineLength = $lineLen + ($i === false ? $size : $i); + + if ($currentLine && $newLineLength >= $thisLineLength) { $lines[$lNo] = ''; $currentLine = &$lines[$lNo++]; $thisLineLength = $maxLineLength; $lineLen = 0; } - $lineLen += $size; + $currentLine .= $enc; + + if ($i === false) { + $lineLen += $size; + } else { + // 6 is the length of '=0D=0A'. + $lineLen = $size - strrpos($enc, '=0D=0A') - 6; + } } return $this->_standardize(implode("=\r\n", $lines)); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/FileSpool.php libphp-swiftmailer-5.4.2/lib/classes/Swift/FileSpool.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/FileSpool.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/FileSpool.php 2016-05-01 08:45:47.000000000 +0000 @@ -39,7 +39,7 @@ if (!file_exists($this->_path)) { if (!mkdir($this->_path, 0777, true)) { - throw new Swift_IoException('Unable to create Path ['.$this->_path.']'); + throw new Swift_IoException(sprintf('Unable to create path "%s".', $this->_path)); } } } @@ -108,7 +108,7 @@ } } - throw new Swift_IoException('Unable to create a file for enqueuing Message'); + throw new Swift_IoException(sprintf('Unable to create a file for enqueuing Message in "%s".', $this->_path)); } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/KeyCache/DiskKeyCache.php libphp-swiftmailer-5.4.2/lib/classes/Swift/KeyCache/DiskKeyCache.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/KeyCache/DiskKeyCache.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/KeyCache/DiskKeyCache.php 2016-05-01 08:45:47.000000000 +0000 @@ -289,10 +289,7 @@ private function _getHandle($nsKey, $itemKey, $position) { if (!isset($this->_keys[$nsKey][$itemKey])) { - $openMode = $this->hasKey($nsKey, $itemKey) - ? 'r+b' - : 'w+b' - ; + $openMode = $this->hasKey($nsKey, $itemKey) ? 'r+b' : 'w+b'; $fp = fopen($this->_path.'/'.$nsKey.'/'.$itemKey, $openMode); $this->_keys[$nsKey][$itemKey] = $fp; } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mailer.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mailer.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mailer.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mailer.php 2016-05-01 08:45:47.000000000 +0000 @@ -69,7 +69,7 @@ * @param Swift_Mime_Message $message * @param array $failedRecipients An array of failures by-reference * - * @return int + * @return int The number of successful recipients. Can be 0 which indicates failure */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/MemorySpool.php libphp-swiftmailer-5.4.2/lib/classes/Swift/MemorySpool.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/MemorySpool.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/MemorySpool.php 2016-05-01 08:45:47.000000000 +0000 @@ -16,6 +16,7 @@ class Swift_MemorySpool implements Swift_Spool { protected $messages = array(); + private $flushRetries = 3; /** * Tests if this Transport mechanism has started. @@ -42,6 +43,14 @@ } /** + * @param int $retries + */ + public function setFlushRetries($retries) + { + $this->flushRetries = $retries; + } + + /** * Stores a message in the queue. * * @param Swift_Mime_Message $message The message to store @@ -75,8 +84,25 @@ } $count = 0; - while ($message = array_pop($this->messages)) { - $count += $transport->send($message, $failedRecipients); + $retries = $this->flushRetries; + while ($retries--) { + try { + while ($message = array_pop($this->messages)) { + $count += $transport->send($message, $failedRecipients); + } + } catch (Swift_TransportException $exception) { + if ($retries) { + // re-queue the message at the end of the queue to give a chance + // to the other messages to be sent, in case the failure was due to + // this message and not just the transport failing + array_unshift($this->messages, $message); + + // wait half a second before we try again + usleep(500000); + } else { + throw $exception; + } + } } return $count; diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/Attachment.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/Attachment.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/Attachment.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/Attachment.php 2016-05-01 08:45:47.000000000 +0000 @@ -69,9 +69,7 @@ public function setDisposition($disposition) { if (!$this->_setHeaderFieldModel('Content-Disposition', $disposition)) { - $this->getHeaders()->addParameterizedHeader( - 'Content-Disposition', $disposition - ); + $this->getHeaders()->addParameterizedHeader('Content-Disposition', $disposition); } return $this; @@ -139,9 +137,7 @@ $this->setFilename(basename($file->getPath())); $this->setBody($file, $contentType); if (!isset($contentType)) { - $extension = strtolower(substr( - $file->getPath(), strrpos($file->getPath(), '.') + 1 - )); + $extension = strtolower(substr($file->getPath(), strrpos($file->getPath(), '.') + 1)); if (array_key_exists($extension, $this->_mimeTypes)) { $this->setContentType($this->_mimeTypes[$extension]); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php 2016-05-01 08:45:47.000000000 +0000 @@ -95,15 +95,26 @@ } $enc = $this->_encodeByteSequence($bytes, $size); - if ($currentLine && $lineLen + $size >= $thisLineLength) { + + $i = strpos($enc, '=0D=0A'); + $newLineLength = $lineLen + ($i === false ? $size : $i); + + if ($currentLine && $newLineLength >= $thisLineLength) { $is->write($prepend.$this->_standardize($currentLine)); $currentLine = ''; $prepend = "=\r\n"; $thisLineLength = $maxLineLength; $lineLen = 0; } - $lineLen += $size; + $currentLine .= $enc; + + if ($i === false) { + $lineLen += $size; + } else { + // 6 is the length of '=0D=0A'. + $lineLen = $size - strrpos($enc, '=0D=0A') - 6; + } } if (strlen($currentLine)) { $is->write($prepend.$this->_standardize($currentLine)); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php 2016-05-01 08:45:47.000000000 +0000 @@ -61,6 +61,7 @@ public function charsetChanged($charset) { $this->charset = $charset; + $this->safeEncoder->charsetChanged($charset); } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/Grammar.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/Grammar.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/Grammar.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/Grammar.php 2016-05-01 08:45:47.000000000 +0000 @@ -129,11 +129,11 @@ { if (array_key_exists($name, self::$_grammar)) { return self::$_grammar[$name]; - } else { - throw new Swift_RfcComplianceException( - "No such grammar '".$name."' defined." - ); } + + throw new Swift_RfcComplianceException( + "No such grammar '".$name."' defined." + ); } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/Headers/ParameterizedHeader.php 2016-05-01 08:45:47.000000000 +0000 @@ -98,9 +98,7 @@ { $params = $this->getParameters(); - return array_key_exists($parameter, $params) - ? $params[$parameter] - : null; + return array_key_exists($parameter, $params) ? $params[$parameter] : null; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/MimePart.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/MimePart.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/MimePart.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/MimePart.php 2016-05-01 08:45:47.000000000 +0000 @@ -128,9 +128,7 @@ */ public function getDelSp() { - return ($this->_getHeaderParameter('Content-Type', 'delsp') == 'yes') - ? true - : false; + return 'yes' == $this->_getHeaderParameter('Content-Type', 'delsp') ? true : false; } /** @@ -196,7 +194,7 @@ protected function _convertString($string) { $charset = strtolower($this->getCharset()); - if (!in_array($charset, array('utf-8', 'iso-8859-1', ''))) { + if (!in_array($charset, array('utf-8', 'iso-8859-1', 'iso-8859-15', ''))) { // mb_convert_encoding must be the first one to check, since iconv cannot convert some words. if (function_exists('mb_convert_encoding')) { $string = mb_convert_encoding($string, $charset, 'utf-8'); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleHeaderFactory.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleHeaderFactory.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleHeaderFactory.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleHeaderFactory.php 2016-05-01 08:45:47.000000000 +0000 @@ -112,12 +112,7 @@ public function createParameterizedHeader($name, $value = null, $params = array()) { - $header = new Swift_Mime_Headers_ParameterizedHeader($name, - $this->_encoder, (strtolower($name) == 'content-disposition') - ? $this->_paramEncoder - : null, - $this->_grammar - ); + $header = new Swift_Mime_Headers_ParameterizedHeader($name, $this->_encoder, strtolower($name) == 'content-disposition' ? $this->_paramEncoder : null, $this->_grammar); if (isset($value)) { $header->setFieldBodyModel($value); } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleHeaderSet.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleHeaderSet.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleHeaderSet.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleHeaderSet.php 2016-05-01 08:45:47.000000000 +0000 @@ -349,12 +349,13 @@ { $lowerA = strtolower($a); $lowerB = strtolower($b); - $aPos = array_key_exists($lowerA, $this->_order) - ? $this->_order[$lowerA] - : -1; - $bPos = array_key_exists($lowerB, $this->_order) - ? $this->_order[$lowerB] - : -1; + $aPos = array_key_exists($lowerA, $this->_order) ? $this->_order[$lowerA] : -1; + $bPos = array_key_exists($lowerB, $this->_order) ? $this->_order[$lowerB] : -1; + + if (-1 === $aPos && -1 === $bPos) { + // just be sure to be determinist here + return $a > $b ? -1 : 1; + } if ($aPos == -1) { return 1; @@ -362,7 +363,7 @@ return -1; } - return ($aPos < $bPos) ? -1 : 1; + return $aPos < $bPos ? -1 : 1; } /** Test if the given Header is always displayed */ diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleMessage.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleMessage.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleMessage.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleMessage.php 2016-05-01 08:45:47.000000000 +0000 @@ -253,7 +253,7 @@ * If $name is passed and the first parameter is a string, this name will be * associated with the address. * - * @param string $addresses + * @param mixed $addresses * @param string $name optional * * @return Swift_Mime_SimpleMessage diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleMimeEntity.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleMimeEntity.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Mime/SimpleMimeEntity.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Mime/SimpleMimeEntity.php 2016-05-01 08:45:47.000000000 +0000 @@ -282,11 +282,7 @@ { // TODO: Try to refactor this logic - $compoundLevel = isset($compoundLevel) - ? $compoundLevel - : $this->_getCompoundLevel($children) - ; - + $compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->_getCompoundLevel($children); $immediateChildren = array(); $grandchildren = array(); $newContentType = $this->_userContentType; @@ -311,15 +307,15 @@ } } - if (!empty($immediateChildren)) { + if ($immediateChildren) { $lowestLevel = $this->_getNeededChildLevel($immediateChildren[0], $compoundLevel); // Determine which composite media type is needed to accommodate the // immediate children foreach ($this->_compositeRanges as $mediaType => $range) { - if ($lowestLevel > $range[0] - && $lowestLevel <= $range[1]) { + if ($lowestLevel > $range[0] && $lowestLevel <= $range[1]) { $newContentType = $mediaType; + break; } } @@ -349,9 +345,7 @@ */ public function getBody() { - return ($this->_body instanceof Swift_OutputByteStream) - ? $this->_readStream($this->_body) - : $this->_body; + return $this->_body instanceof Swift_OutputByteStream ? $this->_readStream($this->_body) : $this->_body; } /** @@ -486,12 +480,8 @@ if ($this->_cache->hasKey($this->_cacheKey, 'body')) { $body = $this->_cache->getString($this->_cacheKey, 'body'); } else { - $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, - $this->getMaxLineLength() - ); - $this->_cache->setString($this->_cacheKey, 'body', $body, - Swift_KeyCache::MODE_WRITE - ); + $body = "\r\n".$this->_encoder->encodeString($this->getBody(), 0, $this->getMaxLineLength()); + $this->_cache->setString($this->_cacheKey, 'body', $body, Swift_KeyCache::MODE_WRITE); } $string .= $body; } @@ -602,9 +592,9 @@ $this->_headers->get($field)->setFieldBodyModel($model); return true; - } else { - return false; } + + return false; } /** @@ -626,9 +616,9 @@ $this->_headers->get($field)->setParameter($parameter, $value); return true; - } else { - return false; } + + return false; } /** @@ -716,9 +706,7 @@ private function _assertValidBoundary($boundary) { - if (!preg_match( - '/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', - $boundary)) { + if (!preg_match('/^[a-z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-z0-9\'\(\)\+_\-,\.\/:=\?]$/Di', $boundary)) { throw new Swift_RfcComplianceException('Mime boundary set is not RFC 2046 compliant.'); } } @@ -757,18 +745,16 @@ $realLevel = $child->getNestingLevel(); $lowercaseType = strtolower($child->getContentType()); - if (isset($filter[$realLevel]) - && isset($filter[$realLevel][$lowercaseType])) { + if (isset($filter[$realLevel]) && isset($filter[$realLevel][$lowercaseType])) { return $filter[$realLevel][$lowercaseType]; - } else { - return $realLevel; } + + return $realLevel; } private function _createChild() { - return new self($this->_headers->newInstance(), - $this->_encoder, $this->_cache, $this->_grammar); + return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_grammar); } private function _notifyEncoderChanged(Swift_Mime_ContentEncoder $encoder) @@ -807,17 +793,13 @@ private function _childSortAlgorithm($a, $b) { $typePrefs = array(); - $types = array( - strtolower($a->getContentType()), - strtolower($b->getContentType()), - ); + $types = array(strtolower($a->getContentType()), strtolower($b->getContentType())); + foreach ($types as $type) { - $typePrefs[] = (array_key_exists($type, $this->_alternativePartOrder)) - ? $this->_alternativePartOrder[$type] - : (max($this->_alternativePartOrder) + 1); + $typePrefs[] = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1; } - return ($typePrefs[0] >= $typePrefs[1]) ? 1 : -1; + return $typePrefs[0] >= $typePrefs[1] ? 1 : -1; } // -- Destructor @@ -839,14 +821,8 @@ */ private function _assertValidId($id) { - if (!preg_match( - '/^'.$this->_grammar->getDefinition('id-left').'@'. - $this->_grammar->getDefinition('id-right').'$/D', - $id - )) { - throw new Swift_RfcComplianceException( - 'Invalid ID given <'.$id.'>' - ); + if (!preg_match('/^'.$this->_grammar->getDefinition('id-left').'@'.$this->_grammar->getDefinition('id-right').'$/D', $id)) { + throw new Swift_RfcComplianceException('Invalid ID given <'.$id.'>'); } } @@ -857,7 +833,7 @@ { $this->_headers = clone $this->_headers; $this->_encoder = clone $this->_encoder; - $this->_cacheKey = uniqid(); + $this->_cacheKey = md5(uniqid(getmypid().mt_rand(), true)); $children = array(); foreach ($this->_children as $pos => $child) { $children[$pos] = clone $child; diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Plugins/DecoratorPlugin.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Plugins/DecoratorPlugin.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Plugins/DecoratorPlugin.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Plugins/DecoratorPlugin.php 2016-05-01 08:45:47.000000000 +0000 @@ -157,12 +157,9 @@ { if ($this->_replacements instanceof Swift_Plugins_Decorator_Replacements) { return $this->_replacements->getReplacementsFor($address); - } else { - return isset($this->_replacements[$address]) - ? $this->_replacements[$address] - : null - ; } + + return isset($this->_replacements[$address]) ? $this->_replacements[$address] : null; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Plugins/ReporterPlugin.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Plugins/ReporterPlugin.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Plugins/ReporterPlugin.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Plugins/ReporterPlugin.php 2016-05-01 08:45:47.000000000 +0000 @@ -49,25 +49,13 @@ $message = $evt->getMessage(); $failures = array_flip($evt->getFailedRecipients()); foreach ((array) $message->getTo() as $address => $null) { - $this->_reporter->notify( - $message, $address, (array_key_exists($address, $failures) - ? Swift_Plugins_Reporter::RESULT_FAIL - : Swift_Plugins_Reporter::RESULT_PASS) - ); + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); } foreach ((array) $message->getCc() as $address => $null) { - $this->_reporter->notify( - $message, $address, (array_key_exists($address, $failures) - ? Swift_Plugins_Reporter::RESULT_FAIL - : Swift_Plugins_Reporter::RESULT_PASS) - ); + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); } foreach ((array) $message->getBcc() as $address => $null) { - $this->_reporter->notify( - $message, $address, (array_key_exists($address, $failures) - ? Swift_Plugins_Reporter::RESULT_FAIL - : Swift_Plugins_Reporter::RESULT_PASS) - ); + $this->_reporter->notify($message, $address, array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS); } } } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Plugins/ThrottlerPlugin.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Plugins/ThrottlerPlugin.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Plugins/ThrottlerPlugin.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Plugins/ThrottlerPlugin.php 2016-05-01 08:45:47.000000000 +0000 @@ -151,9 +151,9 @@ { if (isset($this->_timer)) { return $this->_timer->getTimestamp(); - } else { - return time(); } + + return time(); } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/DKIMSigner.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/DKIMSigner.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/DKIMSigner.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/DKIMSigner.php 2016-05-01 08:45:47.000000000 +0000 @@ -62,12 +62,12 @@ * * @var array */ - protected $_ignoredHeaders = array(); + protected $_ignoredHeaders = array('return-path' => true); /** * Signer identity. * - * @var unknown_type + * @var string */ protected $_signerIdentity; @@ -143,13 +143,6 @@ */ protected $_dkimHeader; - /** - * Hash Handler. - * - * @var hash_ressource - */ - private $_headerHashHandler; - private $_bodyHashHandler; private $_headerHash; @@ -206,7 +199,6 @@ { $this->_headerHash = null; $this->_signedHeaders = array(); - $this->_headerHashHandler = null; $this->_bodyHash = null; $this->_bodyHashHandler = null; $this->_bodyCanonIgnoreStart = 2; @@ -381,7 +373,7 @@ $this->_showLen = true; $this->_maxLen = PHP_INT_MAX; } elseif ($len === false) { - $this->showLen = false; + $this->_showLen = false; $this->_maxLen = PHP_INT_MAX; } else { $this->_showLen = true; @@ -394,7 +386,7 @@ /** * Set the signature timestamp. * - * @param timestamp $time + * @param int $time A timestamp * * @return Swift_Signers_DKIMSigner */ @@ -408,7 +400,7 @@ /** * Set the signature expiration timestamp. * - * @param timestamp $time + * @param int $time A timestamp * * @return Swift_Signers_DKIMSigner */ @@ -588,9 +580,13 @@ $this->_addToHeaderHash($header); } + /** + * @deprecated This method is currently useless in this class but it must be + * kept for BC reasons due to its "protected" scope. This method + * might be overriden by custom client code. + */ protected function _endOfHeaders() { - //$this->_headerHash=hash_final($this->_headerHashHandler, true); } protected function _canonicalizeBody($string) diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/DomainKeySigner.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/DomainKeySigner.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/DomainKeySigner.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/DomainKeySigner.php 2016-05-01 08:45:47.000000000 +0000 @@ -141,7 +141,7 @@ /** * Resets internal states. * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function reset() { @@ -170,7 +170,7 @@ * @throws Swift_IoException * * @return int - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function write($bytes) { @@ -188,7 +188,7 @@ * * @throws Swift_IoException * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function commit() { @@ -203,7 +203,7 @@ * * @param Swift_InputByteStream $is * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function bind(Swift_InputByteStream $is) { @@ -221,7 +221,7 @@ * * @param Swift_InputByteStream $is * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function unbind(Swift_InputByteStream $is) { @@ -243,7 +243,7 @@ * * @throws Swift_IoException * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function flushBuffers() { @@ -257,7 +257,7 @@ * * @param string $hash * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function setHashAlgorithm($hash) { @@ -271,7 +271,7 @@ * * @param string $canon simple | nofws defaults to simple * - * @return Swift_Signers_DomainKeysSigner + * @return Swift_Signers_DomainKeySigner */ public function setCanon($canon) { @@ -336,9 +336,9 @@ { if ($this->_debugHeaders) { return array('DomainKey-Signature', 'X-DebugHash'); - } else { - return array('DomainKey-Signature'); } + + return array('DomainKey-Signature'); } /** @@ -502,7 +502,7 @@ $this->_hashHandler = hash_init('sha1'); break; } - $this->_canonLine = ''; + $this->_bodyCanonLine = ''; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/OpenDKIMSigner.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/OpenDKIMSigner.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/OpenDKIMSigner.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/OpenDKIMSigner.php 2016-05-01 08:45:47.000000000 +0000 @@ -29,11 +29,12 @@ public function __construct($privateKey, $domainName, $selector) { - if (extension_loaded('opendkim')) { - $this->_peclLoaded = true; - } else { + if (!extension_loaded('opendkim')) { throw new Swift_SwiftException('php-opendkim extension not found'); } + + $this->_peclLoaded = true; + parent::__construct($privateKey, $domainName, $selector); } @@ -61,9 +62,9 @@ if (is_bool($bodyLen)) { $bodyLen = -1; } - $hash = ($this->_hashAlgorithm == 'rsa-sha1') ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256; - $bodyCanon = ($this->_bodyCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; - $headerCanon = ($this->_headerCanon == 'simple') ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; + $hash = $this->_hashAlgorithm == 'rsa-sha1' ? OpenDKIMSign::ALG_RSASHA1 : OpenDKIMSign::ALG_RSASHA256; + $bodyCanon = $this->_bodyCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; + $headerCanon = $this->_headerCanon == 'simple' ? OpenDKIMSign::CANON_SIMPLE : OpenDKIMSign::CANON_RELAXED; $this->_dkimHandler = new OpenDKIMSign($this->_privateKey, $this->_selector, $this->_domainName, $headerCanon, $bodyCanon, $hash, $bodyLen); // Hardcode signature Margin for now $this->_dkimHandler->setMargin(78); @@ -130,7 +131,7 @@ /** * Set the signature timestamp. * - * @param timestamp $time + * @param int $time * * @return Swift_Signers_DKIMSigner */ @@ -144,7 +145,7 @@ /** * Set the signature expiration timestamp. * - * @param timestamp $time + * @param int $time * * @return Swift_Signers_DKIMSigner */ diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/SMimeSigner.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/SMimeSigner.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Signers/SMimeSigner.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Signers/SMimeSigner.php 2016-05-01 08:45:47.000000000 +0000 @@ -41,9 +41,9 @@ /** * Constructor. * - * @param string $certificate - * @param string $privateKey - * @param string $encryptCertificate + * @param string|null $signCertificate + * @param string|null $signPrivateKey + * @param string|null $encryptCertificate */ public function __construct($signCertificate = null, $signPrivateKey = null, $encryptCertificate = null) { @@ -167,7 +167,7 @@ * But some older mail clients, namely Microsoft Outlook 2000 will work when the message first encrypted. * As this goes against the official specs, its recommended to only use 'encryption -> signing' when specifically targeting these 'broken' clients. * - * @param string $signThenEncrypt + * @param bool $signThenEncrypt * * @return Swift_Signers_SMimeSigner */ @@ -400,7 +400,6 @@ } $boundary = trim($contentTypeData['1'], '"'); - $boundaryLen = strlen($boundary); // Skip the header and CRLF CRLF $fromStream->setReadPointer($headersPosEnd + 4); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/AbstractSmtpTransport.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/AbstractSmtpTransport.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/AbstractSmtpTransport.php 2016-05-01 08:45:47.000000000 +0000 @@ -417,7 +417,7 @@ foreach ($recipients as $forwardPath) { try { $this->_doRcptToCommand($forwardPath); - $sent++; + ++$sent; } catch (Swift_TransportException $e) { $failedRecipients[] = $forwardPath; } @@ -461,11 +461,17 @@ /** Try to determine the hostname of the server this is run on */ private function _lookupHostname() { - if (!empty($_SERVER['SERVER_NAME']) - && $this->_isFqdn($_SERVER['SERVER_NAME'])) { + if (!empty($_SERVER['SERVER_NAME']) && $this->_isFqdn($_SERVER['SERVER_NAME'])) { $this->_domain = $_SERVER['SERVER_NAME']; } elseif (!empty($_SERVER['SERVER_ADDR'])) { - $this->_domain = sprintf('[%s]', $_SERVER['SERVER_ADDR']); + // Set the address literal tag (See RFC 5321, section: 4.1.3) + if (false === strpos($_SERVER['SERVER_ADDR'], ':')) { + $prefix = ''; // IPv4 addresses are not tagged. + } else { + $prefix = 'IPv6:'; // Adding prefix in case of IPv6. + } + + $this->_domain = sprintf('[%s%s]', $prefix, $_SERVER['SERVER_ADDR']); } } @@ -475,9 +481,9 @@ // We could do a really thorough check, but there's really no point if (false !== $dotPos = strpos($hostname, '.')) { return ($dotPos > 0) && ($dotPos != strlen($hostname) - 1); - } else { - return false; } + + return false; } /** diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php 2016-05-01 08:45:47.000000000 +0000 @@ -373,7 +373,7 @@ $binary = $this->si2bin($time, 64); // create 64 bit binary string $timestamp = ''; - for ($i = 0; $i < 8; $i++) { + for ($i = 0; $i < 8; ++$i) { $timestamp .= chr(bindec(substr($binary, -(($i + 1) * 8), 8))); } @@ -437,7 +437,7 @@ { $material = array(bin2hex($key[0])); $len = strlen($key); - for ($i = 1; $i < $len; $i++) { + for ($i = 1; $i < $len; ++$i) { list($high, $low) = str_split(bin2hex($key[$i])); $v = $this->castToByte(ord($key[$i - 1]) << (7 + 1 - $i) | $this->uRShift(hexdec(dechex(hexdec($high) & 0xf).dechex(hexdec($low) & 0xf)), $i)); $material[] = str_pad(substr(dechex($v), -2), 2, '0', STR_PAD_LEFT); // cast to byte diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/Esmtp/AuthHandler.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/Esmtp/AuthHandler.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/Esmtp/AuthHandler.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/Esmtp/AuthHandler.php 2016-05-01 08:45:47.000000000 +0000 @@ -172,7 +172,7 @@ foreach ($this->_getAuthenticatorsForAgent() as $authenticator) { if (in_array(strtolower($authenticator->getAuthKeyword()), array_map('strtolower', $this->_esmtpParams))) { - $count++; + ++$count; if ($authenticator->authenticate($agent, $this->_username, $this->_password)) { return; } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/EsmtpTransport.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/EsmtpTransport.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/EsmtpTransport.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/EsmtpTransport.php 2016-05-01 08:45:47.000000000 +0000 @@ -42,6 +42,7 @@ 'blocking' => 1, 'tls' => false, 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'stream_context_options' => array(), ); /** @@ -139,6 +140,7 @@ */ public function setEncryption($encryption) { + $encryption = strtolower($encryption); if ('tls' == $encryption) { $this->_params['protocol'] = 'tcp'; $this->_params['tls'] = true; @@ -161,6 +163,30 @@ } /** + * Sets the stream context options. + * + * @param array $options + * + * @return Swift_Transport_EsmtpTransport + */ + public function setStreamOptions($options) + { + $this->_params['stream_context_options'] = $options; + + return $this; + } + + /** + * Returns the stream context options. + * + * @return array + */ + public function getStreamOptions() + { + return $this->_params['stream_context_options']; + } + + /** * Sets the source IP. * * @param string $source @@ -197,7 +223,8 @@ foreach ($handlers as $handler) { $assoc[$handler->getHandledKeyword()] = $handler; } - uasort($assoc, array($this, '_sortHandlers')); + + @uasort($assoc, array($this, '_sortHandlers')); $this->_handlers = $assoc; $this->_setHandlerParams(); diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/FailoverTransport.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/FailoverTransport.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/FailoverTransport.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/FailoverTransport.php 2016-05-01 08:45:47.000000000 +0000 @@ -22,9 +22,7 @@ */ private $_currentTransport; - /** - * Creates a new FailoverTransport. - */ + // needed as __construct is called from elsewhere explicitly public function __construct() { parent::__construct(); @@ -45,6 +43,7 @@ { $maxTransports = count($this->_transports); $sent = 0; + $this->_lastUsedTransport = null; for ($i = 0; $i < $maxTransports && $transport = $this->_getNextTransport(); ++$i) { @@ -53,7 +52,11 @@ $transport->start(); } - return $transport->send($message, $failedRecipients); + if ($sent = $transport->send($message, $failedRecipients)) { + $this->_lastUsedTransport = $transport; + + return $sent; + } } catch (Swift_TransportException $e) { $this->_killCurrentTransport(); } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/LoadBalancedTransport.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/LoadBalancedTransport.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/LoadBalancedTransport.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/LoadBalancedTransport.php 2016-05-01 08:45:47.000000000 +0000 @@ -30,8 +30,13 @@ protected $_transports = array(); /** - * Creates a new LoadBalancedTransport. + * The Transport used in the last successful send operation. + * + * @var Swift_Transport */ + protected $_lastUsedTransport = null; + + // needed as __construct is called from elsewhere explicitly public function __construct() { } @@ -58,6 +63,16 @@ } /** + * Get the Transport used in the last successful send operation. + * + * @return Swift_Transport + */ + public function getLastUsedTransport() + { + return $this->_lastUsedTransport; + } + + /** * Test if this Transport mechanism has started. * * @return bool @@ -100,6 +115,7 @@ { $maxTransports = count($this->_transports); $sent = 0; + $this->_lastUsedTransport = null; for ($i = 0; $i < $maxTransports && $transport = $this->_getNextTransport(); ++$i) { @@ -108,6 +124,7 @@ $transport->start(); } if ($sent = $transport->send($message, $failedRecipients)) { + $this->_lastUsedTransport = $transport; break; } } catch (Swift_TransportException $e) { diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/MailTransport.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/MailTransport.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/MailTransport.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/MailTransport.php 2016-05-01 08:45:47.000000000 +0000 @@ -156,15 +156,16 @@ if ("\r\n" != PHP_EOL) { // Non-windows (not using SMTP) $headers = str_replace("\r\n", PHP_EOL, $headers); + $subject = str_replace("\r\n", PHP_EOL, $subject); $body = str_replace("\r\n", PHP_EOL, $body); } else { // Windows, using SMTP $headers = str_replace("\r\n.", "\r\n..", $headers); + $subject = str_replace("\r\n.", "\r\n..", $subject); $body = str_replace("\r\n.", "\r\n..", $body); } - if ($this->_invoker->mail($to, $subject, $body, $headers, - sprintf($this->_extraParams, $reversePath))) { + if ($this->_invoker->mail($to, $subject, $body, $headers, $this->_formatExtraParams($this->_extraParams, $reversePath))) { if ($evt) { $evt->setResult(Swift_Events_SendEvent::RESULT_SUCCESS); $evt->setFailedRecipients($failedRecipients); @@ -234,4 +235,21 @@ return $path; } + + /** + * Return php mail extra params to use for invoker->mail. + * + * @param $extraParams + * @param $reversePath + * + * @return string|null + */ + private function _formatExtraParams($extraParams, $reversePath) + { + if (false !== strpos($extraParams, '-f%s')) { + $extraParams = empty($reversePath) ? str_replace('-f%s', '', $extraParams) : sprintf($extraParams, escapeshellarg($reversePath)); + } + + return !empty($extraParams) ? $extraParams : null; + } } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/SendmailTransport.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/SendmailTransport.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/SendmailTransport.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/SendmailTransport.php 2016-05-01 08:45:47.000000000 +0000 @@ -102,6 +102,7 @@ $failedRecipients = (array) $failedRecipients; $command = $this->getCommand(); $buffer = $this->getBuffer(); + $count = 0; if (false !== strpos($command, ' -t')) { if ($evt = $this->_eventDispatcher->createSendEvent($this, $message)) { diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/SimpleMailInvoker.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/SimpleMailInvoker.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/SimpleMailInvoker.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/SimpleMailInvoker.php 2016-05-01 08:45:47.000000000 +0000 @@ -32,8 +32,8 @@ { if (!ini_get('safe_mode')) { return @mail($to, $subject, $body, $headers, $extraParams); - } else { - return @mail($to, $subject, $body, $headers); } + + return @mail($to, $subject, $body, $headers); } } diff -Nru libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/StreamBuffer.php libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/StreamBuffer.php --- libphp-swiftmailer-5.4.1/lib/classes/Swift/Transport/StreamBuffer.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/lib/classes/Swift/Transport/StreamBuffer.php 2016-05-01 08:45:47.000000000 +0000 @@ -260,7 +260,11 @@ if (!empty($this->_params['sourceIp'])) { $options['socket']['bindto'] = $this->_params['sourceIp'].':0'; } - $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options)); + if (isset($this->_params['stream_context_options'])) { + $options = array_merge($options, $this->_params['stream_context_options']); + } + $streamContext = stream_context_create($options); + $this->_stream = @stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $streamContext); if (false === $this->_stream) { throw new Swift_TransportException( 'Connection could not be established with host '.$this->_params['host']. diff -Nru libphp-swiftmailer-5.4.1/LICENSE libphp-swiftmailer-5.4.2/LICENSE --- libphp-swiftmailer-5.4.1/LICENSE 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/LICENSE 2016-05-01 08:45:47.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2013 Fabien Potencier +Copyright (c) 2013-2016 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru libphp-swiftmailer-5.4.1/phpunit.xml.dist libphp-swiftmailer-5.4.2/phpunit.xml.dist --- libphp-swiftmailer-5.4.1/phpunit.xml.dist 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/phpunit.xml.dist 2016-05-01 08:45:47.000000000 +0000 @@ -32,6 +32,6 @@ - + diff -Nru libphp-swiftmailer-5.4.1/README libphp-swiftmailer-5.4.2/README --- libphp-swiftmailer-5.4.1/README 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/README 2016-05-01 08:45:47.000000000 +0000 @@ -6,7 +6,6 @@ Homepage: http://swiftmailer.org Documentation: http://swiftmailer.org/docs -Mailing List: http://groups.google.com/group/swiftmailer Bugs: https://github.com/swiftmailer/swiftmailer/issues Repository: https://github.com/swiftmailer/swiftmailer diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -36,6 +36,10 @@ $text = file_get_contents($sampleDir.'/'.$sampleFile); $encodedText = $encoder->encodeString($text); + foreach (explode("\r\n", $encodedText) as $line) { + $this->assertLessThanOrEqual(76, strlen($line)); + } + $this->assertEquals( quoted_printable_decode($encodedText), $text, '%s: Encoded string should decode back to original string for sample '. diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -2,6 +2,8 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase { + protected $_samplesDir; + /** * @var Swift_Mime_ContentEncoder_NativeQpContentEncoder */ diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -35,8 +35,8 @@ $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline'."\r\n". - 'Content-ID: '."\r\n", + 'Content-ID: '."\r\n". + 'Content-Disposition: inline'."\r\n", $file->toString() ); } @@ -50,8 +50,8 @@ $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: attachment'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: attachment'."\r\n", $file->toString() ); } @@ -65,8 +65,8 @@ $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=foo.pdf'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; filename=foo.pdf'."\r\n", $file->toString() ); } @@ -80,8 +80,8 @@ $this->assertEquals( 'Content-Type: application/pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; size=12340'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; size=12340'."\r\n", $file->toString() ); } @@ -93,11 +93,12 @@ $file->setContentType('application/pdf'); $file->setFilename('foo.pdf'); $file->setSize(12340); + $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n". - 'Content-ID: <'.$id.'>'."\r\n", + 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n", $file->toString() ); } @@ -113,8 +114,8 @@ $this->assertEquals( 'Content-Type: application/pdf; name=foo.pdf'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n". 'Content-ID: <'.$id.'>'."\r\n". + 'Content-Disposition: inline; filename=foo.pdf; size=12340'."\r\n". "\r\n". base64_encode('abcd'), $file->toString() diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -778,8 +778,8 @@ '--\\2'."\r\n". 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". 'Content-ID: <'.$cid.'>'."\r\n". + 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -857,8 +857,8 @@ '--\\1'."\r\n". 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". 'Content-ID: <'.$cid.'>'."\r\n". + 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -938,8 +938,8 @@ '--\\1'."\r\n". 'Content-Type: image/jpeg; name=myimage.jpg'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". 'Content-ID: <'.$cid.'>'."\r\n". + 'Content-Disposition: inline; filename=myimage.jpg'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -29,6 +29,6 @@ 'protocol' => 'tcp', 'blocking' => 1, 'timeout' => 15, - )); + )); } } diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -4,6 +4,8 @@ { protected $_buffer; + protected $_randomHighPort; + protected $_server; public function setUp() @@ -41,7 +43,7 @@ 'protocol' => 'tcp', 'blocking' => 1, 'timeout' => 1, - )); + )); } public function testTimeoutException() diff -Nru libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php --- libphp-swiftmailer-5.4.1/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -36,6 +36,6 @@ 'protocol' => 'ssl', 'blocking' => 1, 'timeout' => 15, - )); + )); } } diff -Nru libphp-swiftmailer-5.4.1/tests/bootstrap.php libphp-swiftmailer-5.4.2/tests/bootstrap.php --- libphp-swiftmailer-5.4.1/tests/bootstrap.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/bootstrap.php 2016-05-01 08:45:47.000000000 +0000 @@ -1,11 +1,13 @@ add('Swift_', __DIR__.'/unit'); +require_once dirname(__DIR__).'/vendor/autoload.php'; + +// Disable garbage collector to prevent segfaults +gc_disable(); set_include_path(get_include_path().PATH_SEPARATOR.dirname(__DIR__).'/lib'); -\Mockery::getConfiguration()->allowMockingNonExistentMethods(false); +Mockery::getConfiguration()->allowMockingNonExistentMethods(false); if (is_file(__DIR__.'/acceptance.conf.php')) { require_once __DIR__.'/acceptance.conf.php'; diff -Nru libphp-swiftmailer-5.4.1/tests/bug/Swift/Bug274Test.php libphp-swiftmailer-5.4.2/tests/bug/Swift/Bug274Test.php --- libphp-swiftmailer-5.4.1/tests/bug/Swift/Bug274Test.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/bug/Swift/Bug274Test.php 2016-05-01 08:45:47.000000000 +0000 @@ -2,14 +2,14 @@ class Swift_Bug274Test extends \PHPUnit_Framework_TestCase { - public function testEmptyFileNameAsAttachement() + public function testEmptyFileNameAsAttachment() { $message = new Swift_Message(); $this->setExpectedException('Swift_IoException', 'The path cannot be empty'); $message->attach(Swift_Attachment::fromPath('')); } - public function testNonEmptyFileNameAsAttachement() + public function testNonEmptyFileNameAsAttachment() { $message = new Swift_Message(); try { diff -Nru libphp-swiftmailer-5.4.1/tests/bug/Swift/Bug34Test.php libphp-swiftmailer-5.4.2/tests/bug/Swift/Bug34Test.php --- libphp-swiftmailer-5.4.1/tests/bug/Swift/Bug34Test.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/bug/Swift/Bug34Test.php 2016-05-01 08:45:47.000000000 +0000 @@ -60,8 +60,8 @@ '--\\1'."\r\n". 'Content-Type: image/gif; name=image.gif'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=image.gif'."\r\n". 'Content-ID: <'.$cidVal.'>'."\r\n". + 'Content-Disposition: inline; filename=image.gif'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". diff -Nru libphp-swiftmailer-5.4.1/tests/bug/Swift/Bug38Test.php libphp-swiftmailer-5.4.2/tests/bug/Swift/Bug38Test.php --- libphp-swiftmailer-5.4.1/tests/bug/Swift/Bug38Test.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/bug/Swift/Bug38Test.php 2016-05-01 08:45:47.000000000 +0000 @@ -57,8 +57,8 @@ '--'.$boundary."\r\n". 'Content-Type: image/gif; name=image.gif'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=image.gif'."\r\n". 'Content-ID: <'.preg_quote($imgId, '~').'>'."\r\n". + 'Content-Disposition: inline; filename=image.gif'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". @@ -106,8 +106,8 @@ '--'.$boundary."\r\n". 'Content-Type: image/gif; name=image.gif'."\r\n". 'Content-Transfer-Encoding: base64'."\r\n". - 'Content-Disposition: inline; filename=image.gif'."\r\n". 'Content-ID: <'.preg_quote($imgId, '~').'>'."\r\n". + 'Content-Disposition: inline; filename=image.gif'."\r\n". "\r\n". preg_quote(base64_encode(''), '~'). "\r\n\r\n". diff -Nru libphp-swiftmailer-5.4.1/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php libphp-swiftmailer-5.4.2/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php --- libphp-swiftmailer-5.4.1/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php 1970-01-01 00:00:00.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/bug/Swift/BugFileByteStreamConsecutiveReadCallsTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -0,0 +1,19 @@ +read(100); + } catch (\Swift_IoException $exc) { + $fbs->read(100); + } + } +} diff -Nru libphp-swiftmailer-5.4.1/tests/fixtures/EsmtpTransportFixture.php libphp-swiftmailer-5.4.2/tests/fixtures/EsmtpTransportFixture.php --- libphp-swiftmailer-5.4.1/tests/fixtures/EsmtpTransportFixture.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/fixtures/EsmtpTransportFixture.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; diff -Nru libphp-swiftmailer-5.4.1/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php libphp-swiftmailer-5.4.2/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php --- libphp-swiftmailer-5.4.1/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -5,6 +5,8 @@ */ class Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase { + private $_attFile; + public function setUp() { $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; diff -Nru libphp-swiftmailer-5.4.1/tests/smoke/Swift/Smoke/InternationalSmokeTest.php libphp-swiftmailer-5.4.2/tests/smoke/Swift/Smoke/InternationalSmokeTest.php --- libphp-swiftmailer-5.4.1/tests/smoke/Swift/Smoke/InternationalSmokeTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/smoke/Swift/Smoke/InternationalSmokeTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -5,6 +5,8 @@ */ class Swift_Smoke_InternationalSmokeTest extends SwiftMailerSmokeTestCase { + private $_attFile; + public function setUp() { $this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip'; diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -54,9 +54,7 @@ public function testResettingPointerAfterExhaustion() { $input = array('a', 'b', 'c'); - $bs = $this->_createArrayStream($input); - - while (false !== $bs->read(1)); + $bs = $this->_createArrayStream($input); while (false !== $bs->read(1)); $bs->setReadPointer(0); $this->assertEquals('a', $bs->read(1), diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Encoder/QpEncoderTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Encoder/QpEncoderTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Encoder/QpEncoderTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Encoder/QpEncoderTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -372,10 +372,31 @@ ); } + public function testTextIsPreWrapped() + { + $encoder = $this->createEncoder(); + + $input = str_repeat('a', 70)."\r\n". + str_repeat('a', 70)."\r\n". + str_repeat('a', 70); + + $this->assertEquals( + $input, $encoder->encodeString($input) + ); + } + // -- Creation methods private function _createCharStream() { return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); } + + private function createEncoder() + { + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8'); + + return new Swift_Encoder_QpEncoder($charStream); + } } diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/MailerTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/MailerTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/MailerTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/MailerTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -140,11 +140,6 @@ return $this->getMockery('Swift_Mime_Message')->shouldIgnoreMissing(); } - private function _createIterator() - { - return $this->getMockery('Swift_Mailer_RecipientIterator')->shouldIgnoreMissing(); - } - private function _createMailer(Swift_Transport $transport) { return new Swift_Mailer($transport); diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Mime/AbstractMimeEntityTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Mime/AbstractMimeEntityTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Mime/AbstractMimeEntityTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Mime/AbstractMimeEntityTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -379,7 +379,7 @@ $this->_createEncoder(), $this->_createCache() ); $firstBoundary = $entity->getBoundary(); - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < 10; ++$i) { $this->assertEquals($firstBoundary, $entity->getBoundary()); } } @@ -540,13 +540,13 @@ $child1 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, "Content-Type: text/plain\r\n". "\r\n". - 'foobar' + 'foobar', 'text/plain' ); $child2 = new MimeEntityFixture(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, "Content-Type: text/html\r\n". "\r\n". - 'foobar' + 'foobar', 'text/html' ); $headers->shouldReceive('toString') @@ -623,7 +623,7 @@ "\r\n". 'data'. "\r\n\r\n--xxx--\r\n". - "\$~", + '$~', $entity->toString() ); } diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -50,7 +50,7 @@ $encoder = $this->_getEncoder('7bit'); $chars = array(); - for ($i = 0; $i < 50; $i++) { + for ($i = 0; $i < 50; ++$i) { $chars[] = 'a'; } $input = implode(' ', $chars); //99 chars long @@ -75,7 +75,7 @@ ->zeroOrMoreTimes() ->andReturnUsing($collection); - for ($i = 0; $i < 50; $i++) { + for ($i = 0; $i < 50; ++$i) { $os->shouldReceive('read') ->once() ->andReturn('a '); diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -472,6 +472,25 @@ $encoder->charsetChanged('windows-1252'); } + public function testTextIsPreWrapped() + { + $encoder = $this->createEncoder(); + + $input = str_repeat('a', 70)."\r\n". + str_repeat('a', 70)."\r\n". + str_repeat('a', 70); + + $os = new Swift_ByteStream_ArrayByteStream(); + $is = new Swift_ByteStream_ArrayByteStream(); + $is->write($input); + + $encoder->encodeByteStream($is, $os); + + $this->assertEquals( + $input, $os->read(PHP_INT_MAX) + ); + } + // -- Creation Methods private function _createCharacterStream($stub = false) @@ -479,9 +498,12 @@ return $this->getMockery('Swift_CharacterStream')->shouldIgnoreMissing(); } - private function _createEncoder($charStream) + private function createEncoder() { - return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream); + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $charStream = new Swift_CharacterStream_NgCharacterStream($factory, 'utf-8'); + + return new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); } private function _createOutputByteStream($stub = false) diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Plugins/AntiFloodPluginTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Plugins/AntiFloodPluginTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Plugins/AntiFloodPluginTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Plugins/AntiFloodPluginTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -29,7 +29,7 @@ $evt = $this->_createSendEvent($transport); $plugin = new Swift_Plugins_AntiFloodPlugin(10); - for ($i = 0; $i < 12; $i++) { + for ($i = 0; $i < 12; ++$i) { $plugin->sendPerformed($evt); } } @@ -45,7 +45,7 @@ $evt = $this->_createSendEvent($transport); $plugin = new Swift_Plugins_AntiFloodPlugin(2); - for ($i = 0; $i < 11; $i++) { + for ($i = 0; $i < 11; ++$i) { $plugin->sendPerformed($evt); } } @@ -66,7 +66,7 @@ $evt = $this->_createSendEvent($transport); $plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper); - for ($i = 0; $i < 101; $i++) { + for ($i = 0; $i < 101; ++$i) { $plugin->sendPerformed($evt); } } diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -2,6 +2,10 @@ class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCase { + private $_monitor; + + private $_bytes = 0; + public function setUp() { $this->_monitor = new Swift_Plugins_BandwidthMonitorPlugin(); @@ -117,7 +121,6 @@ return $msg; } - private $_bytes = 0; public function _write($is) { for ($i = 0; $i < $this->_bytes; ++$i) { diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -1,7 +1,6 @@ shouldReceive('getPriorityOver') ->zeroOrMoreTimes() ->with('STARTTLS') - ->andReturn(0); + ->andReturn(1); $ext2->shouldReceive('getHandledKeyword') ->zeroOrMoreTimes() ->andReturn('STARTTLS'); @@ -142,7 +140,7 @@ { $buf = $this->_getBuffer(); $dispatcher = $this->_createEventDispatcher(); - $smtp = new EsmtpTransportFixture($buf, array(), $dispatcher); + $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher); $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); @@ -228,7 +226,7 @@ { $buf = $this->_getBuffer(); $dispatcher = $this->_createEventDispatcher(); - $smtp = new EsmtpTransportFixture($buf, array(), $dispatcher); + $smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher); $ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); $ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing(); diff -Nru libphp-swiftmailer-5.4.1/tests/unit/Swift/Transport/MailTransportTest.php libphp-swiftmailer-5.4.2/tests/unit/Swift/Transport/MailTransportTest.php --- libphp-swiftmailer-5.4.1/tests/unit/Swift/Transport/MailTransportTest.php 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/tests/unit/Swift/Transport/MailTransportTest.php 2016-05-01 08:45:47.000000000 +0000 @@ -84,7 +84,7 @@ $transport->send($message); } - public function testTransportUsesHeadersFromMessage() + public function testTransportSettingUsingReturnPathForExtraParams() { $invoker = $this->_createInvoker(); $dispatcher = $this->_createEventDispatcher(); @@ -93,16 +93,118 @@ $headers = $this->_createHeaders(); $message = $this->_createMessage($headers); - $message->shouldReceive('toString') + $message->shouldReceive('getReturnPath') ->zeroOrMoreTimes() ->andReturn( + 'foo@bar' + ); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-f\'foo@bar\''); + + $transport->send($message); + } + + public function testTransportSettingEmptyExtraParams() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), null); + + $transport->send($message); + } + + public function testTransportSettingSettingExtraParamsWithF() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + $transport->setExtraParams('-x\'foo\' -f%s'); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn( + 'foo@bar' + ); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-x\'foo\' -f\'foo@bar\''); + + $transport->send($message); + } + + public function testTransportSettingSettingExtraParamsWithoutF() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + $transport->setExtraParams('-x\'foo\''); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $message->shouldReceive('getReturnPath') + ->zeroOrMoreTimes() + ->andReturn( + 'foo@bar' + ); + $message->shouldReceive('getSender') + ->zeroOrMoreTimes() + ->andReturn(null); + $message->shouldReceive('getFrom') + ->zeroOrMoreTimes() + ->andReturn(null); + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), \Mockery::any(), '-x\'foo\''); + + $transport->send($message); + } + + public function testTransportUsesHeadersFromMessage() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $message->shouldReceive('toString') + ->zeroOrMoreTimes() + ->andReturn( "Subject: Stuff\r\n". "\r\n". 'This body' - ); + ); $invoker->shouldReceive('mail') - ->once() - ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), 'Subject: Stuff'.PHP_EOL, \Mockery::any()); + ->once() + ->with(\Mockery::any(), \Mockery::any(), \Mockery::any(), 'Subject: Stuff'.PHP_EOL, \Mockery::any()); $transport->send($message); } @@ -248,6 +350,45 @@ $transport->send($message); } + + public function testMessageHeadersOnlyHavePHPEolsDuringSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $subject = $this->_createHeader(); + $subject->shouldReceive('getFieldBody')->andReturn("Foo\r\nBar"); + + $headers = $this->_createHeaders(array( + 'Subject' => $subject, + )); + $message = $this->_createMessage($headers); + $message->shouldReceive('toString') + ->zeroOrMoreTimes() + ->andReturn( + "From: Foo\r\n\r\n". + "\r\n". + "This\r\n". + 'body' + ); + + if ("\r\n" != PHP_EOL) { + $expectedHeaders = "From: Foo\n\n"; + $expectedSubject = "Foo\nBar"; + $expectedBody = "This\nbody"; + } else { + $expectedHeaders = "From: Foo\r\n\r\n"; + $expectedSubject = "Foo\r\nBar"; + $expectedBody = "This\r\nbody"; + } + + $invoker->shouldReceive('mail') + ->once() + ->with(\Mockery::any(), $expectedSubject, $expectedBody, $expectedHeaders, \Mockery::any()); + + $transport->send($message); + } // -- Creation Methods diff -Nru libphp-swiftmailer-5.4.1/.travis.yml libphp-swiftmailer-5.4.2/.travis.yml --- libphp-swiftmailer-5.4.1/.travis.yml 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/.travis.yml 2016-05-01 08:45:47.000000000 +0000 @@ -1,17 +1,13 @@ language: php -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - hhvm-nightly +sudo: false before_script: - cp tests/acceptance.conf.php.default tests/acceptance.conf.php - cp tests/smoke.conf.php.default tests/smoke.conf.php - composer self-update - composer update --no-interaction --prefer-source + - gem install mime-types -v 2.99.1 - gem install mailcatcher - mailcatcher --smtp-port 4456 @@ -19,7 +15,14 @@ - phpunit --verbose matrix: - allow_failures: - - php: 5.6 - - php: hhvm-nightly - fast_finish: true + include: + - php: 5.3 + - php: 5.4 + - php: 5.5 + - php: 5.6 + - php: 7.0 + - php: hhvm + allow_failures: + - php: 7.0 + - php: hhvm + fast_finish: true diff -Nru libphp-swiftmailer-5.4.1/VERSION libphp-swiftmailer-5.4.2/VERSION --- libphp-swiftmailer-5.4.1/VERSION 2015-06-06 14:19:39.000000000 +0000 +++ libphp-swiftmailer-5.4.2/VERSION 2016-05-01 08:45:47.000000000 +0000 @@ -1 +1 @@ -Swift-5.4.1 +Swift-5.4.2