Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into 5.x
Browse files Browse the repository at this point in the history
# Conflicts:
#	.travis.yml
#	composer.json
#	lib/classes/Swift.php
#	lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php
#	lib/classes/Swift/ByteStream/ArrayByteStream.php
#	lib/classes/Swift/ByteStream/FileByteStream.php
#	lib/classes/Swift/CharacterReaderFactory/SimpleCharacterReaderFactory.php
#	lib/classes/Swift/CharacterStream/ArrayCharacterStream.php
#	lib/classes/Swift/CharacterStream/NgCharacterStream.php
#	lib/classes/Swift/ConfigurableSpool.php
#	lib/classes/Swift/DependencyContainer.php
#	lib/classes/Swift/EmbeddedFile.php
#	lib/classes/Swift/Encoder/QpEncoder.php
#	lib/classes/Swift/Encoding.php
#	lib/classes/Swift/Events/EventObject.php
#	lib/classes/Swift/FileSpool.php
#	lib/classes/Swift/Image.php
#	lib/classes/Swift/KeyCache/ArrayKeyCache.php
#	lib/classes/Swift/KeyCache/DiskKeyCache.php
#	lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
#	lib/classes/Swift/Message.php
#	lib/classes/Swift/Mime/Attachment.php
#	lib/classes/Swift/Mime/ContentEncoder/PlainContentEncoder.php
#	lib/classes/Swift/Mime/ContentEncoder/QpContentEncoder.php
#	lib/classes/Swift/Mime/EmbeddedFile.php
#	lib/classes/Swift/Mime/Headers/AbstractHeader.php
#	lib/classes/Swift/Mime/Headers/DateHeader.php
#	lib/classes/Swift/Mime/Headers/IdentificationHeader.php
#	lib/classes/Swift/Mime/Headers/MailboxHeader.php
#	lib/classes/Swift/Mime/Headers/OpenDKIMHeader.php
#	lib/classes/Swift/Mime/Headers/ParameterizedHeader.php
#	lib/classes/Swift/Mime/Headers/PathHeader.php
#	lib/classes/Swift/Mime/Headers/UnstructuredHeader.php
#	lib/classes/Swift/Mime/MimePart.php
#	lib/classes/Swift/Mime/SimpleHeaderFactory.php
#	lib/classes/Swift/Mime/SimpleHeaderSet.php
#	lib/classes/Swift/Mime/SimpleMessage.php
#	lib/classes/Swift/Mime/SimpleMimeEntity.php
#	lib/classes/Swift/MimePart.php
#	lib/classes/Swift/Plugins/BandwidthMonitorPlugin.php
#	lib/classes/Swift/Plugins/DecoratorPlugin.php
#	lib/classes/Swift/Plugins/LoggerPlugin.php
#	lib/classes/Swift/Plugins/PopBeforeSmtpPlugin.php
#	lib/classes/Swift/Plugins/RedirectingPlugin.php
#	lib/classes/Swift/Plugins/Reporters/HitReporter.php
#	lib/classes/Swift/Plugins/ThrottlerPlugin.php
#	lib/classes/Swift/Preferences.php
#	lib/classes/Swift/Signers/DKIMSigner.php
#	lib/classes/Swift/Signers/DomainKeySigner.php
#	lib/classes/Swift/Signers/OpenDKIMSigner.php
#	lib/classes/Swift/StreamFilters/ByteArrayReplacementFilter.php
#	lib/classes/Swift/StreamFilters/StringReplacementFilter.php
#	lib/classes/Swift/Transport/AbstractSmtpTransport.php
#	lib/classes/Swift/Transport/Esmtp/Auth/CramMd5Authenticator.php
#	lib/classes/Swift/Transport/Esmtp/Auth/NTLMAuthenticator.php
#	lib/classes/Swift/Transport/Esmtp/AuthHandler.php
#	lib/classes/Swift/Transport/EsmtpTransport.php
#	lib/classes/Swift/Transport/FailoverTransport.php
#	lib/classes/Swift/Transport/LoadBalancedTransport.php
#	lib/classes/Swift/Transport/MailTransport.php
#	lib/classes/Swift/Transport/NullTransport.php
#	lib/classes/Swift/Transport/SendmailTransport.php
#	lib/classes/Swift/Transport/SpoolTransport.php
#	lib/classes/Swift/Transport/StreamBuffer.php
#	lib/classes/Swift/Validate.php
#	lib/dependency_maps/mime_deps.php
#	lib/preferences.php
#	lib/swift_required.php
#	tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php
#	tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php
#	tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php
#	tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php
#	tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php
#	tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php
#	tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
#	tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php
#	tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
#	tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php
#	tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
#	tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php
#	tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php
#	tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php
#	tests/bug/Swift/Bug206Test.php
#	tests/bug/Swift/Bug650Test.php
#	tests/bug/Swift/Bug76Test.php
#	tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php
#	tests/unit/Swift/CharacterReader/Utf8ReaderTest.php
#	tests/unit/Swift/DependencyContainerTest.php
#	tests/unit/Swift/Encoder/Base64EncoderTest.php
#	tests/unit/Swift/Events/CommandEventTest.php
#	tests/unit/Swift/Events/ResponseEventTest.php
#	tests/unit/Swift/Events/SendEventTest.php
#	tests/unit/Swift/Events/TransportChangeEventTest.php
#	tests/unit/Swift/Events/TransportExceptionEventTest.php
#	tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php
#	tests/unit/Swift/MailerTest.php
#	tests/unit/Swift/MessageTest.php
#	tests/unit/Swift/Mime/AbstractMimeEntityTest.php
#	tests/unit/Swift/Mime/AttachmentTest.php
#	tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php
#	tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php
#	tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php
#	tests/unit/Swift/Mime/EmbeddedFileTest.php
#	tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php
#	tests/unit/Swift/Mime/Headers/DateHeaderTest.php
#	tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php
#	tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php
#	tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php
#	tests/unit/Swift/Mime/Headers/PathHeaderTest.php
#	tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php
#	tests/unit/Swift/Mime/MimePartTest.php
#	tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php
#	tests/unit/Swift/Mime/SimpleHeaderSetTest.php
#	tests/unit/Swift/Mime/SimpleMessageTest.php
#	tests/unit/Swift/Mime/SimpleMimeEntityTest.php
#	tests/unit/Swift/Plugins/AntiFloodPluginTest.php
#	tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php
#	tests/unit/Swift/Plugins/LoggerPluginTest.php
#	tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php
#	tests/unit/Swift/Plugins/RedirectingPluginTest.php
#	tests/unit/Swift/Plugins/Reporters/HitReporterTest.php
#	tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php
#	tests/unit/Swift/Signers/DKIMSignerTest.php
#	tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php
#	tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php
#	tests/unit/Swift/Transport/AbstractSmtpTest.php
#	tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php
#	tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php
#	tests/unit/Swift/Transport/Esmtp/Auth/NTLMAuthenticatorTest.php
#	tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php
#	tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php
#	tests/unit/Swift/Transport/LoadBalancedTransportTest.php
#	tests/unit/Swift/Transport/MailTransportTest.php
#	tests/unit/Swift/Transport/StreamBufferTest.php
  • Loading branch information
voku committed Sep 17, 2016
1 parent f62ac56 commit 98953e5
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 74 deletions.
6 changes: 3 additions & 3 deletions lib/classes/Swift/Mime/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
* @param Swift_Mime_HeaderSet $headers
* @param Swift_Mime_ContentEncoder $encoder
* @param Swift_KeyCache $cache
* @param Swift_EmailValidatorBridge $emailValidator
* @param Swift_IdGenerator $idGenerator
* @param array $mimeTypes optional
*/
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_EmailValidatorBridge $emailValidator, $mimeTypes = array())
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = array())
{
parent::__construct($headers, $encoder, $cache, $emailValidator);
parent::__construct($headers, $encoder, $cache, $idGenerator);
$this->setDisposition('attachment');
$this->setContentType('application/octet-stream');
$this->_mimeTypes = $mimeTypes;
Expand Down
6 changes: 3 additions & 3 deletions lib/classes/Swift/Mime/EmbeddedFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class Swift_Mime_EmbeddedFile extends Swift_Mime_Attachment
* @param Swift_Mime_HeaderSet $headers
* @param Swift_Mime_ContentEncoder $encoder
* @param Swift_KeyCache $cache
* @param Swift_EmailValidatorBridge $emailValidator
* @param Swift_IdGenerator $idGenerator
* @param array $mimeTypes optional
*/
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_EmailValidatorBridge $emailValidator, $mimeTypes = array())
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $mimeTypes = array())
{
parent::__construct($headers, $encoder, $cache, $emailValidator, $mimeTypes);
parent::__construct($headers, $encoder, $cache, $idGenerator, $mimeTypes);
$this->setDisposition('inline');
$this->setId($this->getId());
}
Expand Down
5 changes: 5 additions & 0 deletions lib/classes/Swift/Mime/IdGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
*/
class Swift_Mime_IdGenerator implements Swift_IdGenerator
{
/**
* @var string
*/
private $idRight;

/**
* @param string $idRight
*/
Expand Down
6 changes: 3 additions & 3 deletions lib/classes/Swift/Mime/MimePart.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
* @param Swift_Mime_HeaderSet $headers
* @param Swift_Mime_ContentEncoder $encoder
* @param Swift_KeyCache $cache
* @param Swift_EmailValidatorBridge $emailValidator
* @param Swift_IdGenerator $idGenerator
* @param string $charset
*/
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_EmailValidatorBridge $emailValidator, $charset = null)
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
{
parent::__construct($headers, $encoder, $cache, $emailValidator);
parent::__construct($headers, $encoder, $cache, $idGenerator);

$this->_setNestingLevel(self::LEVEL_ALTERNATIVE);

Expand Down
2 changes: 1 addition & 1 deletion lib/classes/Swift/Mime/SimpleHeaderSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function has($name, $index = 0)
{
$lowerName = Swift::strtolowerWithStaticCache($name);

if (!isset($this->_headers[$lowerName])) {
if (!array_key_exists($lowerName, $this->_headers)) {
return false;
}

Expand Down
14 changes: 7 additions & 7 deletions lib/classes/Swift/Mime/SimpleMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
/**
* Create a new SimpleMessage with $headers, $encoder and $cache.
*
* @param Swift_Mime_HeaderSet $headers
* @param Swift_Mime_HeaderSet $headers
* @param Swift_Mime_ContentEncoder $encoder
* @param Swift_KeyCache $cache
* @param Swift_EmailValidatorBridge $emailValidator
* @param string $charset
* @param Swift_KeyCache $cache
* @param Swift_IdGenerator $idGenerator
* @param string $charset
*/
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_EmailValidatorBridge $emailValidator, $charset = null)
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator, $charset = null)
{
parent::__construct($headers, $encoder, $cache, $emailValidator, $charset);
parent::__construct($headers, $encoder, $cache, $idGenerator, $charset);
$this->getHeaders()->defineOrdering(
array(
'Return-Path',
Expand Down Expand Up @@ -638,7 +638,7 @@ protected function _becomeMimePart()
$this->getHeaders()->newInstance(),
$this->getEncoder(),
$this->_getCache(),
$this->_getEmailValidator(),
$this->_getIdGenerator(),
$this->_userCharset
);
$part->setContentType($this->_userContentType);
Expand Down
60 changes: 12 additions & 48 deletions lib/classes/Swift/Mime/SimpleMimeEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
private $_encoder;

/**
* The validator for email
* Message ID generator
*
* @var Swift_EmailValidatorBridge
* @var Swift_IdGenerator
*/
private $_emailValidator;
private $_idGenerator;

/**
* A mime boundary, if any is used
Expand Down Expand Up @@ -135,14 +135,14 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
* @param Swift_Mime_HeaderSet $headers
* @param Swift_Mime_ContentEncoder $encoder
* @param Swift_KeyCache $cache
* @param Swift_EmailValidatorBridge $emailValidator
* @param Swift_IdGenerator $idGenerator
*/
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_EmailValidatorBridge $emailValidator)
public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator)
{
$this->_cacheKey = $this->_generateNewCacheKey();
$this->_cache = $cache;
$this->_headers = $headers;
$this->_emailValidator = $emailValidator;
$this->_idGenerator = $idGenerator;
$this->setEncoder($encoder);
$this->_headers->defineOrdering(array('Content-Type', 'Content-Transfer-Encoding'));

Expand All @@ -168,7 +168,7 @@ public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEnc
),
);

$this->_id = $this->getRandomId();
$this->_id = $this->_idGenerator->generateId();
}

/**
Expand All @@ -178,7 +178,7 @@ public function __construct(Swift_Mime_HeaderSet $headers, Swift_Mime_ContentEnc
*/
public function generateId()
{
$this->setId($this->getRandomId());
$this->setId($this->_idGenerator->generateId());

return $this->_id;
}
Expand Down Expand Up @@ -731,13 +731,11 @@ protected function _getCache()
}

/**
* Get the email-validator.
*
* @return Swift_EmailValidatorBridge
* @return Swift_IdGenerator
*/
protected function _getEmailValidator()
protected function _getIdGenerator()
{
return $this->_emailValidator;
return $this->_idGenerator;
}

/**
Expand All @@ -748,26 +746,6 @@ protected function _clearCache()
$this->_cache->clearKey($this->_cacheKey, 'body');
}

/**
* Returns a random Content-ID or Message-ID.
*
* @return string
*/
protected function getRandomId()
{
$idLeft = $this->_generateNewCacheKey();
$idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated';
$id = $idLeft . '@' . $idRight;

try {
$this->_assertValidId($id);
} catch (Swift_RfcComplianceException $e) {
$id = $idLeft . '@swift.generated';
}

return $id;
}

/**
* generate a new cache-key
*
Expand Down Expand Up @@ -875,7 +853,7 @@ private function _getNeededChildLevel($child, $compoundLevel)
*/
private function _createChild()
{
return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_emailValidator);
return new self($this->_headers->newInstance(), $this->_encoder, $this->_cache, $this->_idGenerator);
}

/**
Expand Down Expand Up @@ -951,20 +929,6 @@ public function __destruct()
$this->_cache->clearAll($this->_cacheKey);
}

/**
* Throws an Exception if the id passed does not comply with RFC 2822.
*
* @param string $id
*
* @throws Swift_RfcComplianceException
*/
private function _assertValidId($id)
{
if ($this->_emailValidator->isValidWrapper($id) === false) {
throw new Swift_RfcComplianceException('Invalid ID given <' . $id . '>');
}
}

/**
* Make a deep copy of object.
*/
Expand Down
12 changes: 11 additions & 1 deletion lib/dependency_maps/mime_deps.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,23 @@
->register('email.validator')
->asSharedInstanceOf('Swift_EmailValidatorBridge')

->register('mime.idgenerator.idright')
// As SERVER_NAME can come from the user in certain configurations, check that
// it does not contain forbidden characters (see RFC 952 and RFC 2181). Use
// preg_replace() instead of preg_match() to prevent DoS attacks with long host names.
->asValue(!empty($_SERVER['SERVER_NAME']) && preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $_SERVER['SERVER_NAME']) === '' ? $_SERVER['SERVER_NAME'] : 'swift.generated')
->register('mime.idgenerator')
->asSharedInstanceOf('Swift_Mime_IdGenerator')
->withDependencies(array(
'mime.idgenerator.idright',
))
->register('mime.message')
->asNewInstanceOf('Swift_Mime_SimpleMessage')
->withDependencies(array(
'mime.headerset',
'mime.qpcontentencoder',
'cache',
'email.validator',
'mime.idgenerator',
'properties.charset',
))

Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
private $_contentEncoder;
private $_cache;
private $_emailValidator;
private $_idGenerator;
private $_headers;

public function setUp()
Expand All @@ -22,6 +23,7 @@ public function setUp()
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$this->_emailValidator = new Swift_EmailValidatorBridge();
$this->_idGenerator = new Swift_Mime_IdGenerator('example.com');
$this->_headers = new Swift_Mime_SimpleHeaderSet(
new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_emailValidator)
);
Expand Down Expand Up @@ -117,7 +119,7 @@ protected function _createAttachment()
$this->_headers,
$this->_contentEncoder,
$this->_cache,
$this->_emailValidator
$this->_idGenerator
);

return $entity;
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
private $_contentEncoder;
private $_cache;
private $_emailValidator;
private $_idGenerator;
private $_headers;

public function setUp()
Expand All @@ -22,6 +23,7 @@ public function setUp()
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$this->_emailValidator = new Swift_EmailValidatorBridge();
$this->_idGenerator = new Swift_Mime_IdGenerator($this->_emailValidator);
$this->_headers = new Swift_Mime_SimpleHeaderSet(
new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_emailValidator)
);
Expand Down Expand Up @@ -130,7 +132,7 @@ protected function _createEmbeddedFile()
$this->_headers,
$this->_contentEncoder,
$this->_cache,
$this->_emailValidator
$this->_idGenerator
);

return $entity;
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
private $_contentEncoder;
private $_cache;
private $_emailValidator;
private $_idGenerator;
private $_headers;

public function setUp()
Expand All @@ -28,6 +29,7 @@ public function setUp()
new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8')
);
$this->_emailValidator = new Swift_EmailValidatorBridge();
$this->_idGenerator = new Swift_Mime_IdGenerator('example.com');
$this->_headers = new Swift_Mime_SimpleHeaderSet(
new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_emailValidator)
);
Expand Down Expand Up @@ -121,7 +123,7 @@ protected function _createMimePart()
$this->_headers,
$this->_contentEncoder,
$this->_cache,
$this->_emailValidator
$this->_idGenerator
);

return $entity;
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/Swift/Mime/AttachmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ protected function _createEntity($headers, $encoder, $cache)

protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = array())
{
return new Swift_Mime_Attachment($headers, $encoder, $cache, new Swift_EmailValidatorBridge(), $mimeTypes);
$idGenerator = new Swift_Mime_IdGenerator('example.com');

return new Swift_Mime_Attachment($headers, $encoder, $cache, $idGenerator, $mimeTypes);
}

protected function _createFileStream($path, $data, $stub = true)
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/Swift/Mime/EmbeddedFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ protected function _createAttachment($headers, $encoder, $cache, $mimeTypes = ar

private function _createEmbeddedFile($headers, $encoder, $cache)
{
return new Swift_Mime_EmbeddedFile($headers, $encoder, $cache, new Swift_EmailValidatorBridge());
$idGenerator = new Swift_Mime_IdGenerator('example.com');

return new Swift_Mime_EmbeddedFile($headers, $encoder, $cache, $idGenerator);
}
}
4 changes: 3 additions & 1 deletion tests/unit/Swift/Mime/MimePartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ protected function _createEntity($headers, $encoder, $cache)

protected function _createMimePart($headers, $encoder, $cache)
{
return new Swift_Mime_MimePart($headers, $encoder, $cache, new Swift_EmailValidatorBridge());
$idGenerator = new Swift_Mime_IdGenerator('example.com');

return new Swift_Mime_MimePart($headers, $encoder, $cache, $idGenerator);
}
}
4 changes: 3 additions & 1 deletion tests/unit/Swift/Mime/SimpleMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ public function testNestingLevelIsTop()
*/
private function _createMessage($headers, $encoder, $cache)
{
return new Swift_Mime_SimpleMessage($headers, $encoder, $cache, new Swift_EmailValidatorBridge());
$idGenerator = new Swift_Mime_IdGenerator('example.com');

return new Swift_Mime_SimpleMessage($headers, $encoder, $cache, $idGenerator);
}

public function testDateIsReturnedFromHeader()
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/Swift/Mime/SimpleMimeEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class Swift_Mime_SimpleMimeEntityTest extends Swift_Mime_AbstractMimeEntityTest

protected function _createEntity($headerFactory, $encoder, $cache)
{
return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, new Swift_EmailValidatorBridge());
$idGenerator = new Swift_Mime_IdGenerator('example.com');

return new Swift_Mime_SimpleMimeEntity($headerFactory, $encoder, $cache, $idGenerator);
}
}

0 comments on commit 98953e5

Please sign in to comment.