mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-31 09:09:59 +09:00
Update composer dependencies
This commit is contained in:
parent
49cc39e507
commit
cbd324c35b
428 changed files with 17862 additions and 5885 deletions
6
vendor/swiftmailer/swiftmailer/.gitignore
vendored
6
vendor/swiftmailer/swiftmailer/.gitignore
vendored
|
|
@ -1,4 +1,8 @@
|
|||
/.php_cs.cache
|
||||
/.phpunit
|
||||
/build/*
|
||||
/composer.lock
|
||||
/phpunit.xml
|
||||
/tests/acceptance.conf.php
|
||||
/tests/smoke.conf.php
|
||||
/build/*
|
||||
/vendor/
|
||||
|
|
|
|||
15
vendor/swiftmailer/swiftmailer/.php_cs.dist
vendored
Normal file
15
vendor/swiftmailer/swiftmailer/.php_cs.dist
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
return PhpCsFixer\Config::create()
|
||||
->setRules(array(
|
||||
'@Symfony' => true,
|
||||
'@Symfony:risky' => true,
|
||||
'array_syntax' => array('syntax' => 'long'),
|
||||
'no_unreachable_default_argument_value' => false,
|
||||
'braces' => array('allow_single_line_closure' => true),
|
||||
'heredoc_to_nowdoc' => false,
|
||||
'phpdoc_annotation_without_dot' => false,
|
||||
))
|
||||
->setRiskyAllowed(true)
|
||||
->setFinder(PhpCsFixer\Finder::create()->in(__DIR__))
|
||||
;
|
||||
8
vendor/swiftmailer/swiftmailer/.travis.yml
vendored
8
vendor/swiftmailer/swiftmailer/.travis.yml
vendored
|
|
@ -11,8 +11,7 @@ before_script:
|
|||
- gem install mailcatcher
|
||||
- mailcatcher --smtp-port 4456
|
||||
|
||||
script:
|
||||
- phpunit --verbose
|
||||
script: ./vendor/bin/simple-phpunit
|
||||
|
||||
matrix:
|
||||
include:
|
||||
|
|
@ -21,7 +20,12 @@ matrix:
|
|||
- php: 5.5
|
||||
- php: 5.6
|
||||
- php: 7.0
|
||||
- php: 7.1
|
||||
- php: hhvm
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
fast_finish: true
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- .phpunit
|
||||
|
|
|
|||
39
vendor/swiftmailer/swiftmailer/CHANGES
vendored
39
vendor/swiftmailer/swiftmailer/CHANGES
vendored
|
|
@ -1,6 +1,43 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
5.4.8 (2017-05-01)
|
||||
------------------
|
||||
|
||||
* fixed encoding inheritance in addPart()
|
||||
* fixed sorting MIME children when their types are equal
|
||||
|
||||
5.4.7 (2017-04-20)
|
||||
------------------
|
||||
|
||||
* fixed NTLMAuthenticator clobbering bcmath scale
|
||||
|
||||
5.4.6 (2017-02-13)
|
||||
------------------
|
||||
|
||||
* removed exceptions thrown in destructors as they lead to fatal errors
|
||||
* switched to use sha256 by default in DKIM as per the RFC
|
||||
* fixed an 'Undefined variable: pipes' PHP notice
|
||||
* fixed long To headers when using the mail transport
|
||||
* fixed NTLMAuthenticator when no domain is passed with the username
|
||||
* prevented fatal error during unserialization of a message
|
||||
* fixed a PHP warning when sending a message that has a length of a multiple of 8192
|
||||
|
||||
5.4.5 (2016-12-29)
|
||||
------------------
|
||||
|
||||
* SECURITY FIX: fixed CVE-2016-10074 by disallowing potentially unsafe shell characters
|
||||
|
||||
Prior to 5.4.5, the mail transport (Swift_Transport_MailTransport) was vulnerable to passing
|
||||
arbitrary shell arguments if the "From", "ReturnPath" or "Sender" header came
|
||||
from a non-trusted source, potentially allowing Remote Code Execution
|
||||
* deprecated the mail transport
|
||||
|
||||
5.4.4 (2016-11-23)
|
||||
------------------
|
||||
|
||||
* reverted escaping command-line args to mail (PHP mail() function already does it)
|
||||
|
||||
5.4.3 (2016-07-08)
|
||||
------------------
|
||||
|
||||
|
|
@ -23,7 +60,7 @@ Changelog
|
|||
* 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
|
||||
* fixed escaping command-line args to mail
|
||||
|
||||
5.4.1 (2015-06-06)
|
||||
------------------
|
||||
|
|
|
|||
2
vendor/swiftmailer/swiftmailer/VERSION
vendored
2
vendor/swiftmailer/swiftmailer/VERSION
vendored
|
|
@ -1 +1 @@
|
|||
Swift-5.4.3
|
||||
Swift-5.4.8
|
||||
|
|
|
|||
3
vendor/swiftmailer/swiftmailer/composer.json
vendored
3
vendor/swiftmailer/swiftmailer/composer.json
vendored
|
|
@ -18,7 +18,8 @@
|
|||
"php": ">=5.3.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"mockery/mockery": "~0.9.1"
|
||||
"mockery/mockery": "~0.9.1",
|
||||
"symfony/phpunit-bridge": "~3.2"
|
||||
},
|
||||
"autoload": {
|
||||
"files": ["lib/swift_required.php"]
|
||||
|
|
|
|||
16
vendor/swiftmailer/swiftmailer/doc/messages.rst
vendored
16
vendor/swiftmailer/swiftmailer/doc/messages.rst
vendored
|
|
@ -1038,13 +1038,14 @@ priority will not change the way your email is sent -- it is purely an
|
|||
indicative setting for the recipient.
|
||||
|
||||
The priority of a message is an indication to the recipient what significance
|
||||
it has. Swift Mailer allows you to set the priority by calling the ``setPriority`` method. This method takes an integer value between 1 and 5:
|
||||
it has. Swift Mailer allows you to set the priority by calling the
|
||||
``setPriority`` method. This method takes an integer value between 1 and 5:
|
||||
|
||||
* Highest
|
||||
* High
|
||||
* Normal
|
||||
* Low
|
||||
* Lowest
|
||||
* `Swift_Mime_SimpleMessage::PRIORITY_HIGHEST`: 1
|
||||
* `Swift_Mime_SimpleMessage::PRIORITY_HIGH`: 2
|
||||
* `Swift_Mime_SimpleMessage::PRIORITY_NORMAL`: 3
|
||||
* `Swift_Mime_SimpleMessage::PRIORITY_LOW`: 4
|
||||
* `Swift_Mime_SimpleMessage::PRIORITY_LOWEST`: 5
|
||||
|
||||
To set the message priority:
|
||||
|
||||
|
|
@ -1055,3 +1056,6 @@ To set the message priority:
|
|||
|
||||
// Indicate "High" priority
|
||||
$message->setPriority(2);
|
||||
|
||||
// Or use the constant to be more explicit
|
||||
$message->setPriority(Swift_Mime_SimpleMessage::PRIORITY_HIGH);
|
||||
|
|
|
|||
|
|
@ -84,8 +84,6 @@ use for your environment.
|
|||
+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ``Swift_SendmailTransport`` | Communicates with a locally installed ``sendmail`` executable (Linux/UNIX) | Quick time-to-run; Provides less-accurate feedback than SMTP; Requires ``sendmail`` installation |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ``Swift_MailTransport`` | Uses PHP's built-in ``mail()`` function | Very portable; Potentially unpredictable results; Provides extremely weak feedback |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ``Swift_LoadBalancedTransport`` | Cycles through a collection of the other Transports to manage load-reduction | Provides graceful fallback if one Transport fails (e.g. an SMTP server is down); Keeps the load on remote services down by spreading the work |
|
||||
+---------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| ``Swift_FailoverTransport`` | Works in conjunction with a collection of the other Transports to provide high-availability | Provides graceful fallback if one Transport fails (e.g. an SMTP server is down) |
|
||||
|
|
|
|||
44
vendor/swiftmailer/swiftmailer/doc/sending.rst
vendored
44
vendor/swiftmailer/swiftmailer/doc/sending.rst
vendored
|
|
@ -10,7 +10,7 @@ create the Mailer, then you use the Mailer to send the message.
|
|||
To send a Message:
|
||||
|
||||
* Create a Transport from one of the provided Transports --
|
||||
``Swift_SmtpTransport``, ``Swift_SendmailTransport``, ``Swift_MailTransport``
|
||||
``Swift_SmtpTransport``, ``Swift_SendmailTransport``
|
||||
or one of the aggregate Transports.
|
||||
|
||||
* Create an instance of the ``Swift_Mailer`` class, using the Transport as
|
||||
|
|
@ -46,13 +46,10 @@ recipients are delivered to successfully then the value 5 will be returned.
|
|||
;
|
||||
|
||||
/*
|
||||
You could alternatively use a different transport such as Sendmail or Mail:
|
||||
You could alternatively use a different transport such as Sendmail:
|
||||
|
||||
// Sendmail
|
||||
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');
|
||||
|
||||
// Mail
|
||||
$transport = Swift_MailTransport::newInstance();
|
||||
*/
|
||||
|
||||
// Create the Mailer using your created Transport
|
||||
|
|
@ -350,39 +347,6 @@ Serious drawbacks when using this Transport are:
|
|||
|
||||
It's a last resort, and we say that with a passion!
|
||||
|
||||
Using the Mail Transport
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
To use the Mail Transport you simply need to call
|
||||
``Swift_MailTransport::newInstance()``. It's unlikely you'll need to configure
|
||||
the Transport.
|
||||
|
||||
To use the Mail Transport:
|
||||
|
||||
* Call ``Swift_MailTransport::newInstance()``.
|
||||
|
||||
* Use the returned object to create the Mailer.
|
||||
|
||||
Messages will be sent using the ``mail()`` function.
|
||||
|
||||
.. note::
|
||||
|
||||
The ``mail()`` function can take a ``$additional_parameters`` parameter.
|
||||
Swift Mailer sets this to "``-f%s``" by default, where the "``%s``" is
|
||||
substituted with the address of the sender (via a ``sprintf()``) at send
|
||||
time. You may override this default by passing an argument to
|
||||
``newInstance()``.
|
||||
|
||||
.. code-block:: php
|
||||
|
||||
require_once 'lib/swift_required.php';
|
||||
|
||||
// Create the Transport
|
||||
$transport = Swift_MailTransport::newInstance();
|
||||
|
||||
// Create the Mailer using your created Transport
|
||||
$mailer = Swift_Mailer::newInstance($transport);
|
||||
|
||||
Available Methods for Sending Messages
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
@ -414,7 +378,7 @@ To send a Message with ``send()``:
|
|||
|
||||
* Create a Transport from one of the provided Transports --
|
||||
``Swift_SmtpTransport``, ``Swift_SendmailTransport``,
|
||||
``Swift_MailTransport`` or one of the aggregate Transports.
|
||||
or one of the aggregate Transports.
|
||||
|
||||
* Create an instance of the ``Swift_Mailer`` class, using the Transport as
|
||||
it's constructor parameter.
|
||||
|
|
@ -474,7 +438,7 @@ own address shows up in the ``To:`` field, follow the following recipe:
|
|||
|
||||
* Create a Transport from one of the provided Transports --
|
||||
``Swift_SmtpTransport``, ``Swift_SendmailTransport``,
|
||||
``Swift_MailTransport`` or one of the aggregate Transports.
|
||||
or one of the aggregate Transports.
|
||||
|
||||
* Create an instance of the ``Swift_Mailer`` class, using the Transport as
|
||||
it's constructor parameter.
|
||||
|
|
|
|||
|
|
@ -48,8 +48,8 @@ interface Swift_CharacterReader
|
|||
* A value of zero means this is already a valid character.
|
||||
* A value of -1 means this cannot possibly be a valid character.
|
||||
*
|
||||
* @param integer[] $bytes
|
||||
* @param int $size
|
||||
* @param int[] $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -19,22 +19,22 @@ class Swift_CharacterReader_Utf8Reader implements Swift_CharacterReader
|
|||
/** Pre-computed for optimization */
|
||||
private static $length_map = array(
|
||||
// N=0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x0N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x2N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x3N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x4N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x5N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x6N
|
||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x7N
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x8N
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0x9N
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xAN
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // 0xBN
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xCN
|
||||
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // 0xDN
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, // 0xEN
|
||||
4,4,4,4,4,4,4,4,5,5,5,5,6,6,0,0, // 0xFN
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x0N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x1N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x2N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x3N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x4N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x5N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x6N
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x7N
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x8N
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x9N
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xAN
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0xBN
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xCN
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // 0xDN
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 0xEN
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 0, 0, // 0xFN
|
||||
);
|
||||
|
||||
private static $s_length_map = array(
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
|||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return integer[]
|
||||
* @return int[]
|
||||
*/
|
||||
public function readBytes($length)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Swift_DependencyContainer
|
|||
/**
|
||||
* Returns a singleton of the DependencyContainer.
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return self
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
|
|
@ -143,7 +143,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param string $itemName
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function register($itemName)
|
||||
{
|
||||
|
|
@ -160,7 +160,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function asValue($value)
|
||||
{
|
||||
|
|
@ -176,7 +176,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param string $lookup
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function asAliasOf($lookup)
|
||||
{
|
||||
|
|
@ -198,7 +198,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param string $className
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function asNewInstanceOf($className)
|
||||
{
|
||||
|
|
@ -216,7 +216,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param string $className
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function asSharedInstanceOf($className)
|
||||
{
|
||||
|
|
@ -236,7 +236,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param array $lookups
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function withDependencies(array $lookups)
|
||||
{
|
||||
|
|
@ -257,7 +257,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function addConstructorValue($value)
|
||||
{
|
||||
|
|
@ -278,7 +278,7 @@ class Swift_DependencyContainer
|
|||
*
|
||||
* @param string $lookup
|
||||
*
|
||||
* @return Swift_DependencyContainer
|
||||
* @return $this
|
||||
*/
|
||||
public function addConstructorLookup($lookup)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -235,8 +235,8 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
|||
/**
|
||||
* Encode the given byte array into a verbatim QP form.
|
||||
*
|
||||
* @param integer[] $bytes
|
||||
* @param int $size
|
||||
* @param int[] $bytes
|
||||
* @param int $size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
@ -262,7 +262,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
|||
*
|
||||
* @param int $size number of bytes to read
|
||||
*
|
||||
* @return integer[]
|
||||
* @return int[]
|
||||
*/
|
||||
protected function _nextSequence($size = 4)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ class Swift_Encoding
|
|||
return self::_lookup('mime.base64contentencoder');
|
||||
}
|
||||
|
||||
// -- Private Static Methods
|
||||
|
||||
private static function _lookup($key)
|
||||
{
|
||||
return Swift_DependencyContainer::getInstance()->lookup($key);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
|
|||
/**
|
||||
* An array of codes which a successful response will contain.
|
||||
*
|
||||
* @var integer[]
|
||||
* @var int[]
|
||||
*/
|
||||
private $_successCodes = array();
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ class Swift_Events_CommandEvent extends Swift_Events_EventObject
|
|||
/**
|
||||
* Get the numeric response codes which indicate success for this command.
|
||||
*
|
||||
* @return integer[]
|
||||
* @return int[]
|
||||
*/
|
||||
public function getSuccessCodes()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Swift_FailoverTransport extends Swift_Transport_FailoverTransport
|
|||
*
|
||||
* @param Swift_Transport[] $transports
|
||||
*
|
||||
* @return Swift_FailoverTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($transports = array())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Swift_Image extends Swift_EmbeddedFile
|
|||
* @param string $filename
|
||||
* @param string $contentType
|
||||
*
|
||||
* @return Swift_Image
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($data = null, $filename = null, $contentType = null)
|
||||
{
|
||||
|
|
@ -48,14 +48,10 @@ class Swift_Image extends Swift_EmbeddedFile
|
|||
*
|
||||
* @param string $path
|
||||
*
|
||||
* @return Swift_Image
|
||||
* @return self
|
||||
*/
|
||||
public static function fromPath($path)
|
||||
{
|
||||
$image = self::newInstance()->setFile(
|
||||
new Swift_ByteStream_FileByteStream($path)
|
||||
);
|
||||
|
||||
return $image;
|
||||
return self::newInstance()->setFile(new Swift_ByteStream_FileByteStream($path));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Swift_LoadBalancedTransport extends Swift_Transport_LoadBalancedTransport
|
|||
*
|
||||
* @param array $transports
|
||||
*
|
||||
* @return Swift_LoadBalancedTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($transports = array())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
* Sends Messages using the mail() function.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*
|
||||
* @deprecated since 5.4.5 (to be removed in 6.0)
|
||||
*/
|
||||
class Swift_MailTransport extends Swift_Transport_MailTransport
|
||||
{
|
||||
|
|
@ -36,7 +38,7 @@ class Swift_MailTransport extends Swift_Transport_MailTransport
|
|||
*
|
||||
* @param string $extraParams To be passed to mail()
|
||||
*
|
||||
* @return Swift_MailTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($extraParams = '-f%s')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class Swift_Mailer
|
|||
*
|
||||
* @param Swift_Transport $transport
|
||||
*
|
||||
* @return Swift_Mailer
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance(Swift_Transport $transport)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
|
|||
* @param string $contentType
|
||||
* @param string $charset
|
||||
*
|
||||
* @return Swift_Message
|
||||
* @return $this
|
||||
*/
|
||||
public static function newInstance($subject = null, $body = null, $contentType = null, $charset = null)
|
||||
{
|
||||
|
|
@ -82,21 +82,19 @@ class Swift_Message extends Swift_Mime_SimpleMessage
|
|||
* @param string $contentType
|
||||
* @param string $charset
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function addPart($body, $contentType = null, $charset = null)
|
||||
{
|
||||
return $this->attach(Swift_MimePart::newInstance(
|
||||
$body, $contentType, $charset
|
||||
));
|
||||
return $this->attach(Swift_MimePart::newInstance($body, $contentType, $charset)->setEncoder($this->getEncoder()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a new signature handler to the message.
|
||||
* Detach a signature handler from a message.
|
||||
*
|
||||
* @param Swift_Signer $signer
|
||||
*
|
||||
* @return Swift_Message
|
||||
* @return $this
|
||||
*/
|
||||
public function attachSigner(Swift_Signer $signer)
|
||||
{
|
||||
|
|
@ -114,7 +112,7 @@ class Swift_Message extends Swift_Mime_SimpleMessage
|
|||
*
|
||||
* @param Swift_Signer $signer
|
||||
*
|
||||
* @return Swift_Message
|
||||
* @return $this
|
||||
*/
|
||||
public function detachSigner(Swift_Signer $signer)
|
||||
{
|
||||
|
|
@ -281,11 +279,11 @@ class Swift_Message extends Swift_Mime_SimpleMessage
|
|||
{
|
||||
parent::__clone();
|
||||
foreach ($this->bodySigners as $key => $bodySigner) {
|
||||
$this->bodySigners[$key] = clone($bodySigner);
|
||||
$this->bodySigners[$key] = clone $bodySigner;
|
||||
}
|
||||
|
||||
foreach ($this->headerSigners as $key => $headerSigner) {
|
||||
$this->headerSigners[$key] = clone($headerSigner);
|
||||
$this->headerSigners[$key] = clone $headerSigner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
|
|||
*
|
||||
* @param string $disposition
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function setDisposition($disposition)
|
||||
{
|
||||
|
|
@ -90,7 +90,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
|
|||
*
|
||||
* @param string $filename
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function setFilename($filename)
|
||||
{
|
||||
|
|
@ -115,7 +115,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
|
|||
*
|
||||
* @param int $size
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function setSize($size)
|
||||
{
|
||||
|
|
@ -130,7 +130,7 @@ class Swift_Mime_Attachment extends Swift_Mime_SimpleMimeEntity
|
|||
* @param Swift_FileStream $file
|
||||
* @param string $contentType optional
|
||||
*
|
||||
* @return Swift_Mime_Attachment
|
||||
* @return $this
|
||||
*/
|
||||
public function setFile(Swift_FileStream $file, $contentType = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ interface Swift_Mime_HeaderSet extends Swift_Mime_CharsetObserver
|
|||
/**
|
||||
* Create a new instance of this HeaderSet.
|
||||
*
|
||||
* @return Swift_Mime_HeaderSet
|
||||
* @return self
|
||||
*/
|
||||
public function newInstance();
|
||||
|
||||
|
|
|
|||
|
|
@ -219,8 +219,6 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
|
|||
return $this->toString();
|
||||
}
|
||||
|
||||
// -- Points of extension
|
||||
|
||||
/**
|
||||
* Set the name of this Header field.
|
||||
*
|
||||
|
|
@ -449,7 +447,7 @@ abstract class Swift_Mime_Headers_AbstractHeader implements Swift_Mime_Header
|
|||
*/
|
||||
protected function toTokens($string = null)
|
||||
{
|
||||
if (is_null($string)) {
|
||||
if (null === $string) {
|
||||
$string = $this->getFieldBody();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ class Swift_Mime_Headers_DateHeader extends Swift_Mime_Headers_AbstractHeader
|
|||
*/
|
||||
public function setTimestamp($timestamp)
|
||||
{
|
||||
if (!is_null($timestamp)) {
|
||||
if (null !== $timestamp) {
|
||||
$timestamp = (int) $timestamp;
|
||||
}
|
||||
$this->clearCachedValueIf($this->_timestamp != $timestamp);
|
||||
|
|
|
|||
|
|
@ -231,15 +231,13 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
|||
public function getFieldBody()
|
||||
{
|
||||
// Compute the string value of the header only if needed
|
||||
if (is_null($this->getCachedValue())) {
|
||||
if (null === $this->getCachedValue()) {
|
||||
$this->setCachedValue($this->createMailboxListString($this->_mailboxes));
|
||||
}
|
||||
|
||||
return $this->getCachedValue();
|
||||
}
|
||||
|
||||
// -- Points of extension
|
||||
|
||||
/**
|
||||
* Normalizes a user-input list of mailboxes into consistent key=>value pairs.
|
||||
*
|
||||
|
|
@ -298,7 +296,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
|||
* Redefine the encoding requirements for mailboxes.
|
||||
*
|
||||
* All "specials" must be encoded as the full header value will not be quoted
|
||||
*
|
||||
*
|
||||
* @see RFC 2822 3.2.1
|
||||
*
|
||||
* @param string $token
|
||||
|
|
@ -323,7 +321,7 @@ class Swift_Mime_Headers_MailboxHeader extends Swift_Mime_Headers_AbstractHeader
|
|||
|
||||
foreach ($mailboxes as $email => $name) {
|
||||
$mailboxStr = $email;
|
||||
if (!is_null($name)) {
|
||||
if (null !== $name) {
|
||||
$nameStr = $this->createDisplayNameString($name, empty($strings));
|
||||
$mailboxStr = $nameStr.' <'.$mailboxStr.'>';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,11 +30,7 @@ class Swift_Mime_Headers_OpenDKIMHeader implements Swift_Mime_Header
|
|||
private $_fieldName;
|
||||
|
||||
/**
|
||||
* Creates a new SimpleHeader with $name.
|
||||
*
|
||||
* @param string $name
|
||||
* @param Swift_Mime_HeaderEncoder $encoder
|
||||
* @param Swift_Mime_Grammar $grammar
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct($name)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
|
|||
{
|
||||
$body = parent::getFieldBody();
|
||||
foreach ($this->_params as $name => $value) {
|
||||
if (!is_null($value)) {
|
||||
if (null !== $value) {
|
||||
// Add the parameter
|
||||
$body .= '; '.$this->_createParameter($name, $value);
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
|
|||
|
||||
// Try creating any parameters
|
||||
foreach ($this->_params as $name => $value) {
|
||||
if (!is_null($value)) {
|
||||
if (null !== $value) {
|
||||
// Add the semi-colon separator
|
||||
$tokens[count($tokens) - 1] .= ';';
|
||||
$tokens = array_merge($tokens, $this->generateTokenLines(
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ class Swift_Mime_Headers_PathHeader extends Swift_Mime_Headers_AbstractHeader
|
|||
*/
|
||||
public function setAddress($address)
|
||||
{
|
||||
if (is_null($address)) {
|
||||
if (null === $address) {
|
||||
$this->_address = null;
|
||||
} elseif ('' == $address) {
|
||||
$this->_address = '';
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
|||
{
|
||||
parent::__construct($headers, $encoder, $cache, $grammar);
|
||||
$this->setContentType('text/plain');
|
||||
if (!is_null($charset)) {
|
||||
if (null !== $charset) {
|
||||
$this->setCharset($charset);
|
||||
}
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
|||
* @param string $contentType optional
|
||||
* @param string $charset optional
|
||||
*
|
||||
* @return Swift_Mime_MimePart
|
||||
* @return $this
|
||||
*/
|
||||
public function setBody($body, $contentType = null, $charset = null)
|
||||
{
|
||||
|
|
@ -82,7 +82,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
|||
*
|
||||
* @param string $charset
|
||||
*
|
||||
* @return Swift_Mime_MimePart
|
||||
* @return $this
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
|
|
@ -111,7 +111,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
|||
*
|
||||
* @param string $format
|
||||
*
|
||||
* @return Swift_Mime_MimePart
|
||||
* @return $this
|
||||
*/
|
||||
public function setFormat($format)
|
||||
{
|
||||
|
|
@ -136,7 +136,7 @@ class Swift_Mime_MimePart extends Swift_Mime_SimpleMimeEntity
|
|||
*
|
||||
* @param bool $delsp
|
||||
*
|
||||
* @return Swift_Mime_MimePart
|
||||
* @return $this
|
||||
*/
|
||||
public function setDelSp($delsp = true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ class Swift_Mime_SimpleHeaderSet implements Swift_Mime_HeaderSet
|
|||
/**
|
||||
* Create a new instance of this HeaderSet.
|
||||
*
|
||||
* @return Swift_Mime_HeaderSet
|
||||
* @return self
|
||||
*/
|
||||
public function newInstance()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,12 @@
|
|||
*/
|
||||
class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime_Message
|
||||
{
|
||||
const PRIORITY_HIGHEST = 1;
|
||||
const PRIORITY_HIGH = 2;
|
||||
const PRIORITY_NORMAL = 3;
|
||||
const PRIORITY_LOW = 4;
|
||||
const PRIORITY_LOWEST = 5;
|
||||
|
||||
/**
|
||||
* Create a new SimpleMessage with $headers, $encoder and $cache.
|
||||
*
|
||||
|
|
@ -67,7 +73,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param string $subject
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setSubject($subject)
|
||||
{
|
||||
|
|
@ -93,7 +99,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param int $date
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setDate($date)
|
||||
{
|
||||
|
|
@ -119,7 +125,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param string $address
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setReturnPath($address)
|
||||
{
|
||||
|
|
@ -148,7 +154,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string $address
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setSender($address, $name = null)
|
||||
{
|
||||
|
|
@ -181,7 +187,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string $address
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function addFrom($address, $name = null)
|
||||
{
|
||||
|
|
@ -202,7 +208,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string|array $addresses
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setFrom($addresses, $name = null)
|
||||
{
|
||||
|
|
@ -235,7 +241,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string $address
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function addReplyTo($address, $name = null)
|
||||
{
|
||||
|
|
@ -256,7 +262,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param mixed $addresses
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setReplyTo($addresses, $name = null)
|
||||
{
|
||||
|
|
@ -289,7 +295,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string $address
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function addTo($address, $name = null)
|
||||
{
|
||||
|
|
@ -311,7 +317,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param mixed $addresses
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setTo($addresses, $name = null)
|
||||
{
|
||||
|
|
@ -344,7 +350,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string $address
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function addCc($address, $name = null)
|
||||
{
|
||||
|
|
@ -363,7 +369,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param mixed $addresses
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setCc($addresses, $name = null)
|
||||
{
|
||||
|
|
@ -396,7 +402,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param string $address
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function addBcc($address, $name = null)
|
||||
{
|
||||
|
|
@ -415,7 +421,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
* @param mixed $addresses
|
||||
* @param string $name optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setBcc($addresses, $name = null)
|
||||
{
|
||||
|
|
@ -447,16 +453,16 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param int $priority
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setPriority($priority)
|
||||
{
|
||||
$priorityMap = array(
|
||||
1 => 'Highest',
|
||||
2 => 'High',
|
||||
3 => 'Normal',
|
||||
4 => 'Low',
|
||||
5 => 'Lowest',
|
||||
self::PRIORITY_HIGHEST => 'Highest',
|
||||
self::PRIORITY_HIGH => 'High',
|
||||
self::PRIORITY_NORMAL => 'Normal',
|
||||
self::PRIORITY_LOW => 'Low',
|
||||
self::PRIORITY_LOWEST => 'Lowest',
|
||||
);
|
||||
$pMapKeys = array_keys($priorityMap);
|
||||
if ($priority > max($pMapKeys)) {
|
||||
|
|
@ -495,7 +501,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param array $addresses
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function setReadReceiptTo($addresses)
|
||||
{
|
||||
|
|
@ -522,7 +528,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param Swift_Mime_MimeEntity $entity
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function attach(Swift_Mime_MimeEntity $entity)
|
||||
{
|
||||
|
|
@ -536,7 +542,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart implements Swift_Mime
|
|||
*
|
||||
* @param Swift_Mime_MimeEntity $entity
|
||||
*
|
||||
* @return Swift_Mime_SimpleMessage
|
||||
* @return $this
|
||||
*/
|
||||
public function detach(Swift_Mime_MimeEntity $entity)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setContentType($type)
|
||||
{
|
||||
|
|
@ -192,7 +192,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
|
|
@ -223,7 +223,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
|
|
@ -251,7 +251,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
*
|
||||
* @param int $length
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setMaxLineLength($length)
|
||||
{
|
||||
|
|
@ -276,7 +276,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
* @param Swift_Mime_MimeEntity[] $children
|
||||
* @param int $compoundLevel For internal use only
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setChildren(array $children, $compoundLevel = null)
|
||||
{
|
||||
|
|
@ -355,7 +355,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
* @param mixed $body
|
||||
* @param string $contentType optional
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setBody($body, $contentType = null)
|
||||
{
|
||||
|
|
@ -386,7 +386,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
*
|
||||
* @param Swift_Mime_ContentEncoder $encoder
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setEncoder(Swift_Mime_ContentEncoder $encoder)
|
||||
{
|
||||
|
|
@ -422,7 +422,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
*
|
||||
* @throws Swift_RfcComplianceException
|
||||
*
|
||||
* @return Swift_Mime_SimpleMimeEntity
|
||||
* @return $this
|
||||
*/
|
||||
public function setBoundary($boundary)
|
||||
{
|
||||
|
|
@ -786,30 +786,33 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
|||
|
||||
// Sort in order of preference, if there is one
|
||||
if ($shouldSort) {
|
||||
usort($this->_immediateChildren, array($this, '_childSortAlgorithm'));
|
||||
// Group the messages by order of preference
|
||||
$sorted = array();
|
||||
foreach ($this->_immediateChildren as $child) {
|
||||
$type = $child->getContentType();
|
||||
$level = array_key_exists($type, $this->_alternativePartOrder) ? $this->_alternativePartOrder[$type] : max($this->_alternativePartOrder) + 1;
|
||||
|
||||
if (empty($sorted[$level])) {
|
||||
$sorted[$level] = array();
|
||||
}
|
||||
|
||||
$sorted[$level][] = $child;
|
||||
}
|
||||
|
||||
ksort($sorted);
|
||||
|
||||
$this->_immediateChildren = array_reduce($sorted, 'array_merge', array());
|
||||
}
|
||||
}
|
||||
|
||||
private function _childSortAlgorithm($a, $b)
|
||||
{
|
||||
$typePrefs = array();
|
||||
$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;
|
||||
}
|
||||
|
||||
return $typePrefs[0] >= $typePrefs[1] ? 1 : -1;
|
||||
}
|
||||
|
||||
// -- Destructor
|
||||
|
||||
/**
|
||||
* Empties it's own contents from the cache.
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->_cache->clearAll($this->_cacheKey);
|
||||
if ($this->_cache instanceof Swift_KeyCache) {
|
||||
$this->_cache->clearAll($this->_cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class Swift_MimePart extends Swift_Mime_MimePart
|
|||
* @param string $contentType
|
||||
* @param string $charset
|
||||
*
|
||||
* @return Swift_Mime_MimePart
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($body = null, $contentType = null, $charset = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@
|
|||
*/
|
||||
class Swift_NullTransport extends Swift_Transport_NullTransport
|
||||
{
|
||||
/**
|
||||
* Create a new NullTransport.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
call_user_func_array(
|
||||
|
|
@ -30,7 +27,7 @@ class Swift_NullTransport extends Swift_Transport_NullTransport
|
|||
/**
|
||||
* Create a new NullTransport instance.
|
||||
*
|
||||
* @return Swift_NullTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
|
|||
/**
|
||||
* The sender to impersonate.
|
||||
*
|
||||
* @var String
|
||||
* @var string
|
||||
*/
|
||||
private $_sender;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
* @var Swift_Mime_Message[]
|
||||
*/
|
||||
private $messages;
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
|
|||
/**
|
||||
* Get the message list.
|
||||
*
|
||||
* @return array
|
||||
* @return Swift_Mime_Message[]
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
|||
* @param int $port
|
||||
* @param string $crypto as "tls" or "ssl"
|
||||
*
|
||||
* @return Swift_Plugins_PopBeforeSmtpPlugin
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($host, $port = 110, $crypto = null)
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
|||
*
|
||||
* @param Swift_Plugins_Pop_Pop3Connection $connection
|
||||
*
|
||||
* @return Swift_Plugins_PopBeforeSmtpPlugin
|
||||
* @return $this
|
||||
*/
|
||||
public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection)
|
||||
{
|
||||
|
|
@ -99,7 +99,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
|||
*
|
||||
* @param int $timeout
|
||||
*
|
||||
* @return Swift_Plugins_PopBeforeSmtpPlugin
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
|
|
@ -113,7 +113,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
|||
*
|
||||
* @param string $username
|
||||
*
|
||||
* @return Swift_Plugins_PopBeforeSmtpPlugin
|
||||
* @return $this
|
||||
*/
|
||||
public function setUsername($username)
|
||||
{
|
||||
|
|
@ -127,7 +127,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
|||
*
|
||||
* @param string $password
|
||||
*
|
||||
* @return Swift_Plugins_PopBeforeSmtpPlugin
|
||||
* @return $this
|
||||
*/
|
||||
public function setPassword($password)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -98,16 +98,16 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
|
|||
$duration = $time - $this->_start;
|
||||
|
||||
switch ($this->_mode) {
|
||||
case self::BYTES_PER_MINUTE :
|
||||
case self::BYTES_PER_MINUTE:
|
||||
$sleep = $this->_throttleBytesPerMinute($duration);
|
||||
break;
|
||||
case self::MESSAGES_PER_SECOND :
|
||||
case self::MESSAGES_PER_SECOND:
|
||||
$sleep = $this->_throttleMessagesPerSecond($duration);
|
||||
break;
|
||||
case self::MESSAGES_PER_MINUTE :
|
||||
case self::MESSAGES_PER_MINUTE:
|
||||
$sleep = $this->_throttleMessagesPerMinute($duration);
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
$sleep = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class Swift_Preferences
|
|||
/**
|
||||
* Gets the instance of Preferences.
|
||||
*
|
||||
* @return Swift_Preferences
|
||||
* @return self
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
|
|
@ -42,12 +42,11 @@ class Swift_Preferences
|
|||
*
|
||||
* @param string $charset
|
||||
*
|
||||
* @return Swift_Preferences
|
||||
* @return $this
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('properties.charset')->asValue($charset);
|
||||
Swift_DependencyContainer::getInstance()->register('properties.charset')->asValue($charset);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -57,12 +56,11 @@ class Swift_Preferences
|
|||
*
|
||||
* @param string $dir
|
||||
*
|
||||
* @return Swift_Preferences
|
||||
* @return $this
|
||||
*/
|
||||
public function setTempDir($dir)
|
||||
{
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('tempdir')->asValue($dir);
|
||||
Swift_DependencyContainer::getInstance()->register('tempdir')->asValue($dir);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -72,12 +70,11 @@ class Swift_Preferences
|
|||
*
|
||||
* @param string $type
|
||||
*
|
||||
* @return Swift_Preferences
|
||||
* @return $this
|
||||
*/
|
||||
public function setCacheType($type)
|
||||
{
|
||||
Swift_DependencyContainer::getInstance()
|
||||
->register('cache')->asAliasOf(sprintf('cache.%s', $type));
|
||||
Swift_DependencyContainer::getInstance()->register('cache')->asAliasOf(sprintf('cache.%s', $type));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
@ -87,7 +84,7 @@ class Swift_Preferences
|
|||
*
|
||||
* @param bool $dotEscape
|
||||
*
|
||||
* @return Swift_Preferences
|
||||
* @return $this
|
||||
*/
|
||||
public function setQPDotEscape($dotEscape)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class Swift_SendmailTransport extends Swift_Transport_SendmailTransport
|
|||
*
|
||||
* @param string $command
|
||||
*
|
||||
* @return Swift_SendmailTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($command = '/usr/sbin/sendmail -bs')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ interface Swift_Signers_BodySigner extends Swift_Signer
|
|||
*
|
||||
* @param Swift_Message $message
|
||||
*
|
||||
* @return Swift_Signers_BodySigner
|
||||
* @return self
|
||||
*/
|
||||
public function signMessage(Swift_Message $message);
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
/**
|
||||
* Hash algorithm used.
|
||||
*
|
||||
* @see RFC6376 3.3: Signers MUST implement and SHOULD sign using rsa-sha256.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_hashAlgorithm = 'rsa-sha1';
|
||||
protected $_hashAlgorithm = 'rsa-sha256';
|
||||
|
||||
/**
|
||||
* Body canon method.
|
||||
|
|
@ -101,7 +103,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
|
||||
/**
|
||||
* When will the signature expires false means not embedded, if sigTimestamp is auto
|
||||
* Expiration is relative, otherwhise it's absolute.
|
||||
* Expiration is relative, otherwise it's absolute.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
|
|
@ -123,7 +125,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
protected $_signedHeaders = array();
|
||||
|
||||
/**
|
||||
* If debugHeaders is set store debugDatas here.
|
||||
* If debugHeaders is set store debugData here.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
|
@ -174,6 +176,11 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
$this->_domainName = $domainName;
|
||||
$this->_signerIdentity = '@'.$domainName;
|
||||
$this->_selector = $selector;
|
||||
|
||||
// keep fallback hash algorithm sha1 if php version is lower than 5.4.8
|
||||
if (PHP_VERSION_ID < 50408) {
|
||||
$this->_hashAlgorithm = 'rsa-sha1';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -183,7 +190,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
* @param string $domainName
|
||||
* @param string $selector
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($privateKey, $domainName, $selector)
|
||||
{
|
||||
|
|
@ -223,6 +230,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @return int
|
||||
*/
|
||||
// TODO fix return
|
||||
public function write($bytes)
|
||||
{
|
||||
$this->_canonicalizeBody($bytes);
|
||||
|
|
@ -234,8 +242,6 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
/**
|
||||
* For any bytes that are currently buffered inside the stream, force them
|
||||
* off the buffer.
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
|
|
@ -276,8 +282,6 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -292,19 +296,28 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
}
|
||||
|
||||
/**
|
||||
* Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1 defaults to rsa-sha256.
|
||||
* Set hash_algorithm, must be one of rsa-sha256 | rsa-sha1.
|
||||
*
|
||||
* @param string $hash
|
||||
* @param string $hash 'rsa-sha1' or 'rsa-sha256'
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @throws Swift_SwiftException
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHashAlgorithm($hash)
|
||||
{
|
||||
// Unable to sign with rsa-sha256
|
||||
if ($hash == 'rsa-sha1') {
|
||||
$this->_hashAlgorithm = 'rsa-sha1';
|
||||
} else {
|
||||
$this->_hashAlgorithm = 'rsa-sha256';
|
||||
switch ($hash) {
|
||||
case 'rsa-sha1':
|
||||
$this->_hashAlgorithm = 'rsa-sha1';
|
||||
break;
|
||||
case 'rsa-sha256':
|
||||
$this->_hashAlgorithm = 'rsa-sha256';
|
||||
if (!defined('OPENSSL_ALGO_SHA256')) {
|
||||
throw new Swift_SwiftException('Unable to set sha256 as it is not supported by OpenSSL.');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException('Unable to set the hash algorithm, must be one of rsa-sha1 or rsa-sha256 (%s given).', $hash);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
@ -315,7 +328,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $canon
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setBodyCanon($canon)
|
||||
{
|
||||
|
|
@ -333,7 +346,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $canon
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setHeaderCanon($canon)
|
||||
{
|
||||
|
|
@ -351,7 +364,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $identity
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignerIdentity($identity)
|
||||
{
|
||||
|
|
@ -365,7 +378,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param mixed $len (bool or int)
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setBodySignedLen($len)
|
||||
{
|
||||
|
|
@ -388,7 +401,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param int $time A timestamp
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignatureTimestamp($time)
|
||||
{
|
||||
|
|
@ -402,7 +415,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param int $time A timestamp
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignatureExpiration($time)
|
||||
{
|
||||
|
|
@ -432,10 +445,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
{
|
||||
// Init
|
||||
switch ($this->_hashAlgorithm) {
|
||||
case 'rsa-sha256' :
|
||||
case 'rsa-sha256':
|
||||
$this->_bodyHashHandler = hash_init('sha256');
|
||||
break;
|
||||
case 'rsa-sha1' :
|
||||
case 'rsa-sha1':
|
||||
$this->_bodyHashHandler = hash_init('sha1');
|
||||
break;
|
||||
}
|
||||
|
|
@ -567,14 +580,14 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
protected function _addHeader($header, $is_sig = false)
|
||||
{
|
||||
switch ($this->_headerCanon) {
|
||||
case 'relaxed' :
|
||||
case 'relaxed':
|
||||
// Prepare Header and cascade
|
||||
$exploded = explode(':', $header, 2);
|
||||
$name = strtolower(trim($exploded[0]));
|
||||
$value = str_replace("\r\n", '', $exploded[1]);
|
||||
$value = preg_replace("/[ \t][ \t]+/", ' ', $value);
|
||||
$header = $name.':'.trim($value).($is_sig ? '' : "\r\n");
|
||||
case 'simple' :
|
||||
case 'simple':
|
||||
// Nothing to do
|
||||
}
|
||||
$this->_addToHeaderHash($header);
|
||||
|
|
@ -583,7 +596,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
/**
|
||||
* @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.
|
||||
* might be overridden by custom client code.
|
||||
*/
|
||||
protected function _endOfHeaders()
|
||||
{
|
||||
|
|
@ -600,10 +613,10 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
continue;
|
||||
}
|
||||
switch ($string[$i]) {
|
||||
case "\r" :
|
||||
case "\r":
|
||||
$this->_bodyCanonLastChar = "\r";
|
||||
break;
|
||||
case "\n" :
|
||||
case "\n":
|
||||
if ($this->_bodyCanonLastChar == "\r") {
|
||||
if ($method) {
|
||||
$this->_bodyCanonSpace = false;
|
||||
|
|
@ -619,13 +632,13 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
// todo handle it but should never happen
|
||||
}
|
||||
break;
|
||||
case ' ' :
|
||||
case "\t" :
|
||||
case ' ':
|
||||
case "\t":
|
||||
if ($method) {
|
||||
$this->_bodyCanonSpace = true;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
default:
|
||||
if ($this->_bodyCanonEmptyCounter > 0) {
|
||||
$canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter);
|
||||
$this->_bodyCanonEmptyCounter = 0;
|
||||
|
|
@ -678,6 +691,7 @@ class Swift_Signers_DKIMSigner implements Swift_Signers_HeaderSigner
|
|||
private function _getEncryptedHash()
|
||||
{
|
||||
$signature = '';
|
||||
|
||||
switch ($this->_hashAlgorithm) {
|
||||
case 'rsa-sha1':
|
||||
$algorithm = OPENSSL_ALGO_SHA1;
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
* @param string $domainName
|
||||
* @param string $selector
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($privateKey, $domainName, $selector)
|
||||
{
|
||||
|
|
@ -141,7 +141,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
/**
|
||||
* Resets internal states.
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
|
|
@ -169,8 +169,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @throws Swift_IoException
|
||||
*
|
||||
* @return int
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function write($bytes)
|
||||
{
|
||||
|
|
@ -188,7 +187,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @throws Swift_IoException
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
|
|
@ -203,7 +202,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function bind(Swift_InputByteStream $is)
|
||||
{
|
||||
|
|
@ -221,7 +220,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
|
|
@ -230,7 +229,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
if ($stream === $is) {
|
||||
unset($this->_bound[$k]);
|
||||
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +242,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @throws Swift_IoException
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function flushBuffers()
|
||||
{
|
||||
|
|
@ -257,7 +256,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $hash
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setHashAlgorithm($hash)
|
||||
{
|
||||
|
|
@ -271,7 +270,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $canon simple | nofws defaults to simple
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setCanon($canon)
|
||||
{
|
||||
|
|
@ -289,7 +288,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $identity
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignerIdentity($identity)
|
||||
{
|
||||
|
|
@ -303,7 +302,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param bool $debug
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setDebugHeaders($debug)
|
||||
{
|
||||
|
|
@ -346,7 +345,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param string $header_name
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function ignoreHeader($header_name)
|
||||
{
|
||||
|
|
@ -360,7 +359,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param Swift_Mime_HeaderSet $headers
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setHeaders(Swift_Mime_HeaderSet $headers)
|
||||
{
|
||||
|
|
@ -392,7 +391,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
*
|
||||
* @param Swift_Mime_HeaderSet $headers
|
||||
*
|
||||
* @return Swift_Signers_DomainKeySigner
|
||||
* @return $this
|
||||
*/
|
||||
public function addSignature(Swift_Mime_HeaderSet $headers)
|
||||
{
|
||||
|
|
@ -413,14 +412,14 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
protected function _addHeader($header)
|
||||
{
|
||||
switch ($this->_canon) {
|
||||
case 'nofws' :
|
||||
case 'nofws':
|
||||
// Prepare Header and cascade
|
||||
$exploded = explode(':', $header, 2);
|
||||
$name = strtolower(trim($exploded[0]));
|
||||
$value = str_replace("\r\n", '', $exploded[1]);
|
||||
$value = preg_replace("/[ \t][ \t]+/", ' ', $value);
|
||||
$header = $name.':'.trim($value)."\r\n";
|
||||
case 'simple' :
|
||||
case 'simple':
|
||||
// Nothing to do
|
||||
}
|
||||
$this->_addToHash($header);
|
||||
|
|
@ -442,10 +441,10 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
continue;
|
||||
}
|
||||
switch ($string[$i]) {
|
||||
case "\r" :
|
||||
case "\r":
|
||||
$this->_bodyCanonLastChar = "\r";
|
||||
break;
|
||||
case "\n" :
|
||||
case "\n":
|
||||
if ($this->_bodyCanonLastChar == "\r") {
|
||||
if ($nofws) {
|
||||
$this->_bodyCanonSpace = false;
|
||||
|
|
@ -461,14 +460,14 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
throw new Swift_SwiftException('Invalid new line sequence in mail found \n without preceding \r');
|
||||
}
|
||||
break;
|
||||
case ' ' :
|
||||
case "\t" :
|
||||
case ' ':
|
||||
case "\t":
|
||||
case "\x09": //HTAB
|
||||
if ($nofws) {
|
||||
$this->_bodyCanonSpace = true;
|
||||
break;
|
||||
}
|
||||
default :
|
||||
default:
|
||||
if ($this->_bodyCanonEmptyCounter > 0) {
|
||||
$canon .= str_repeat("\r\n", $this->_bodyCanonEmptyCounter);
|
||||
$this->_bodyCanonEmptyCounter = 0;
|
||||
|
|
@ -498,7 +497,7 @@ class Swift_Signers_DomainKeySigner implements Swift_Signers_HeaderSigner
|
|||
{
|
||||
// Init
|
||||
switch ($this->_hashAlgorithm) {
|
||||
case 'rsa-sha1' :
|
||||
case 'rsa-sha1':
|
||||
$this->_hashHandler = hash_init('sha1');
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,21 +20,21 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream
|
|||
*
|
||||
* @param string $header_name
|
||||
*
|
||||
* @return Swift_Signers_HeaderSigner
|
||||
* @return self
|
||||
*/
|
||||
public function ignoreHeader($header_name);
|
||||
|
||||
/**
|
||||
* Prepare the Signer to get a new Body.
|
||||
*
|
||||
* @return Swift_Signers_HeaderSigner
|
||||
* @return self
|
||||
*/
|
||||
public function startBody();
|
||||
|
||||
/**
|
||||
* Give the signal that the body has finished streaming.
|
||||
*
|
||||
* @return Swift_Signers_HeaderSigner
|
||||
* @return self
|
||||
*/
|
||||
public function endBody();
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream
|
|||
*
|
||||
* @param Swift_Mime_SimpleHeaderSet $headers
|
||||
*
|
||||
* @return Swift_Signers_HeaderSigner
|
||||
* @return self
|
||||
*/
|
||||
public function setHeaders(Swift_Mime_HeaderSet $headers);
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ interface Swift_Signers_HeaderSigner extends Swift_Signer, Swift_InputByteStream
|
|||
*
|
||||
* @param Swift_Mime_HeaderSet $headers
|
||||
*
|
||||
* @return Swift_Signers_HeaderSigner
|
||||
* @return self
|
||||
*/
|
||||
public function addSignature(Swift_Mime_HeaderSet $headers);
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
|
|||
*
|
||||
* @param int $time
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignatureTimestamp($time)
|
||||
{
|
||||
|
|
@ -147,7 +147,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
|
|||
*
|
||||
* @param int $time
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignatureExpiration($time)
|
||||
{
|
||||
|
|
@ -161,7 +161,7 @@ class Swift_Signers_OpenDKIMSigner extends Swift_Signers_DKIMSigner
|
|||
*
|
||||
* @param bool $debug
|
||||
*
|
||||
* @return Swift_Signers_DKIMSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setDebugHeaders($debug)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
|||
* @param string $certificate
|
||||
* @param string $privateKey
|
||||
*
|
||||
* @return Swift_Signers_SMimeSigner
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($certificate = null, $privateKey = null)
|
||||
{
|
||||
|
|
@ -84,14 +84,14 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
|||
/**
|
||||
* Set the certificate location to use for signing.
|
||||
*
|
||||
* @link http://www.php.net/manual/en/openssl.pkcs7.flags.php
|
||||
* @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
|
||||
*
|
||||
* @param string $certificate
|
||||
* @param string|array $privateKey If the key needs an passphrase use array('file-location', 'passphrase') instead
|
||||
* @param int $signOptions Bitwise operator options for openssl_pkcs7_sign()
|
||||
* @param string $extraCerts A file containing intermediate certificates needed by the signing certificate
|
||||
*
|
||||
* @return Swift_Signers_SMimeSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignCertificate($certificate, $privateKey = null, $signOptions = PKCS7_DETACHED, $extraCerts = null)
|
||||
{
|
||||
|
|
@ -117,13 +117,13 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
|||
/**
|
||||
* Set the certificate location to use for encryption.
|
||||
*
|
||||
* @link http://www.php.net/manual/en/openssl.pkcs7.flags.php
|
||||
* @link http://nl3.php.net/manual/en/openssl.ciphers.php
|
||||
* @see http://www.php.net/manual/en/openssl.pkcs7.flags.php
|
||||
* @see http://nl3.php.net/manual/en/openssl.ciphers.php
|
||||
*
|
||||
* @param string|array $recipientCerts Either an single X.509 certificate, or an assoc array of X.509 certificates.
|
||||
* @param int $cipher
|
||||
*
|
||||
* @return Swift_Signers_SMimeSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setEncryptCertificate($recipientCerts, $cipher = null)
|
||||
{
|
||||
|
|
@ -169,7 +169,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
|||
*
|
||||
* @param bool $signThenEncrypt
|
||||
*
|
||||
* @return Swift_Signers_SMimeSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function setSignThenEncrypt($signThenEncrypt = true)
|
||||
{
|
||||
|
|
@ -189,7 +189,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
|||
/**
|
||||
* Resets internal states.
|
||||
*
|
||||
* @return Swift_Signers_SMimeSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function reset()
|
||||
{
|
||||
|
|
@ -201,7 +201,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
|||
*
|
||||
* @param Swift_Message $message
|
||||
*
|
||||
* @return Swift_Signers_SMimeSigner
|
||||
* @return $this
|
||||
*/
|
||||
public function signMessage(Swift_Message $message)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport
|
|||
* @param int $port
|
||||
* @param string $security
|
||||
*
|
||||
* @return Swift_SmtpTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance($host = 'localhost', $port = 25, $security = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class Swift_SpoolTransport extends Swift_Transport_SpoolTransport
|
|||
*
|
||||
* @param Swift_Spool $spool
|
||||
*
|
||||
* @return Swift_SpoolTransport
|
||||
* @return self
|
||||
*/
|
||||
public static function newInstance(Swift_Spool $spool)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -124,13 +124,14 @@ class Swift_StreamFilters_ByteArrayReplacementFilter implements Swift_StreamFilt
|
|||
|
||||
$newBuffer = array();
|
||||
$buf_size = count($buffer);
|
||||
$last_size = 0;
|
||||
for ($i = 0; $i < $buf_size; ++$i) {
|
||||
$search_pos = $this->_tree;
|
||||
$last_found = PHP_INT_MAX;
|
||||
// We try to find if the next byte is part of a search pattern
|
||||
for ($j = 0; $j <= $this->_treeMaxLen; ++$j) {
|
||||
// We have a new byte for a search pattern
|
||||
if (isset($buffer [$p = $i + $j]) && isset($search_pos[$buffer[$p]])) {
|
||||
if (isset($buffer[$p = $i + $j]) && isset($search_pos[$buffer[$p]])) {
|
||||
$search_pos = $search_pos[$buffer[$p]];
|
||||
// We have a complete pattern, save, in case we don't find a better match later
|
||||
if (isset($search_pos[-1]) && $search_pos[-1] < $last_found
|
||||
|
|
|
|||
|
|
@ -42,6 +42,10 @@ class Swift_StreamFilters_StringReplacementFilter implements Swift_StreamFilter
|
|||
*/
|
||||
public function shouldBuffer($buffer)
|
||||
{
|
||||
if ('' === $buffer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$endOfBuffer = substr($buffer, -1);
|
||||
foreach ((array) $this->_search as $needle) {
|
||||
if (false !== strpos($needle, $endOfBuffer)) {
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
|
|||
*
|
||||
* @param string $domain
|
||||
*
|
||||
* @return Swift_Transport_AbstractSmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setLocalDomain($domain)
|
||||
{
|
||||
|
|
@ -396,7 +396,7 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
|
|||
do {
|
||||
$line = $this->_buffer->readLine($seq);
|
||||
$response .= $line;
|
||||
} while (null !== $line && false !== $line && ' ' != $line{3});
|
||||
} while (null !== $line && false !== $line && ' ' != $line[3]);
|
||||
} catch (Swift_TransportException $e) {
|
||||
$this->_throwException($e);
|
||||
} catch (Swift_IoException $e) {
|
||||
|
|
@ -491,6 +491,9 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
|
|||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$this->stop();
|
||||
try {
|
||||
$this->stop();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
|||
}
|
||||
|
||||
if (!function_exists('bcmul')) {
|
||||
throw new LogicException('The BCMatch functions must be enabled to use the NTLM authenticator.');
|
||||
throw new LogicException('The BCMath functions must be enabled to use the NTLM authenticator.');
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -296,9 +296,14 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
|||
return explode('\\', $name);
|
||||
}
|
||||
|
||||
list($user, $domain) = explode('@', $name);
|
||||
if (false !== strpos($name, '@')) {
|
||||
list($user, $domain) = explode('@', $name);
|
||||
|
||||
return array($domain, $user);
|
||||
return array($domain, $user);
|
||||
}
|
||||
|
||||
// no domain passed
|
||||
return array('', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -361,11 +366,9 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
|||
protected function getCorrectTimestamp($time)
|
||||
{
|
||||
// Get our timestamp (tricky!)
|
||||
bcscale(0);
|
||||
|
||||
$time = number_format($time, 0, '.', ''); // save microtime to string
|
||||
$time = bcadd($time, '11644473600000'); // add epoch time
|
||||
$time = bcmul($time, 10000); // tenths of a microsecond.
|
||||
$time = bcadd($time, '11644473600000', 0); // add epoch time
|
||||
$time = bcmul($time, 10000, 0); // tenths of a microsecond.
|
||||
|
||||
$binary = $this->si2bin($time, 64); // create 64 bit binary string
|
||||
$timestamp = '';
|
||||
|
|
@ -459,6 +462,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
|||
}
|
||||
|
||||
/** HELPER FUNCTIONS */
|
||||
|
||||
/**
|
||||
* Create our security buffer depending on length and offset.
|
||||
*
|
||||
|
|
@ -561,6 +565,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
|||
}
|
||||
|
||||
/** ENCRYPTION ALGORITHMS */
|
||||
|
||||
/**
|
||||
* DES Encryption.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param string $host
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setHost($host)
|
||||
{
|
||||
|
|
@ -87,7 +87,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param int $port
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setPort($port)
|
||||
{
|
||||
|
|
@ -111,7 +111,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param int $timeout seconds
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setTimeout($timeout)
|
||||
{
|
||||
|
|
@ -136,11 +136,11 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param string $encryption
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setEncryption($encryption)
|
||||
{
|
||||
$encryption = strtolower($encryption);
|
||||
$encryption = strtolower($encryption);
|
||||
if ('tls' == $encryption) {
|
||||
$this->_params['protocol'] = 'tcp';
|
||||
$this->_params['tls'] = true;
|
||||
|
|
@ -167,7 +167,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param array $options
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setStreamOptions($options)
|
||||
{
|
||||
|
|
@ -191,7 +191,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param string $source
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setSourceIp($source)
|
||||
{
|
||||
|
|
@ -215,7 +215,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
*
|
||||
* @param Swift_Transport_EsmtpHandler[] $handlers
|
||||
*
|
||||
* @return Swift_Transport_EsmtpTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setExtensionHandlers(array $handlers)
|
||||
{
|
||||
|
|
@ -270,8 +270,6 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
return parent::executeCommand($command, $codes, $failures);
|
||||
}
|
||||
|
||||
// -- Mixin invocation code
|
||||
|
||||
/** Mixin handling method for ESMTP handlers */
|
||||
public function __call($method, $args)
|
||||
{
|
||||
|
|
@ -281,7 +279,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
|||
)) {
|
||||
$return = call_user_func_array(array($handler, $method), $args);
|
||||
// Allow fluid method calls
|
||||
if (is_null($return) && substr($method, 0, 3) == 'set') {
|
||||
if (null === $return && substr($method, 0, 3) == 'set') {
|
||||
return $this;
|
||||
} else {
|
||||
return $return;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* all-or-nothing result from sending.
|
||||
*
|
||||
* @author Chris Corbyn
|
||||
*
|
||||
* @deprecated since 5.4.5 (to be removed in 6.0)
|
||||
*/
|
||||
class Swift_Transport_MailTransport implements Swift_Transport
|
||||
{
|
||||
|
|
@ -40,6 +42,8 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
|||
*/
|
||||
public function __construct(Swift_Transport_MailInvoker $invoker, Swift_Events_EventDispatcher $eventDispatcher)
|
||||
{
|
||||
@trigger_error(sprintf('The %s class is deprecated since version 5.4.5 and will be removed in 6.0. Use the Sendmail or SMTP transport instead.', __CLASS__), E_USER_DEPRECATED);
|
||||
|
||||
$this->_invoker = $invoker;
|
||||
$this->_eventDispatcher = $eventDispatcher;
|
||||
}
|
||||
|
|
@ -73,7 +77,7 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
|||
*
|
||||
* @param string $params
|
||||
*
|
||||
* @return Swift_Transport_MailTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setExtraParams($params)
|
||||
{
|
||||
|
|
@ -160,11 +164,13 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
|||
$headers = str_replace("\r\n", PHP_EOL, $headers);
|
||||
$subject = str_replace("\r\n", PHP_EOL, $subject);
|
||||
$body = str_replace("\r\n", PHP_EOL, $body);
|
||||
$to = str_replace("\r\n", PHP_EOL, $to);
|
||||
} 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);
|
||||
$to = str_replace("\r\n.", "\r\n..", $to);
|
||||
}
|
||||
|
||||
if ($this->_invoker->mail($to, $subject, $body, $headers, $this->_formatExtraParams($this->_extraParams, $reversePath))) {
|
||||
|
|
@ -238,6 +244,36 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
|||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix CVE-2016-10074 by disallowing potentially unsafe shell characters.
|
||||
*
|
||||
* Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
|
||||
*
|
||||
* @param string $string The string to be validated
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function _isShellSafe($string)
|
||||
{
|
||||
// Future-proof
|
||||
if (escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), array("'$string'", "\"$string\""))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$length = strlen($string);
|
||||
for ($i = 0; $i < $length; ++$i) {
|
||||
$c = $string[$i];
|
||||
// All other characters have a special meaning in at least one common shell, including = and +.
|
||||
// Full stop (.) has a special meaning in cmd.exe, but its impact should be negligible here.
|
||||
// Note that this does permit non-Latin alphanumeric characters based on the current locale.
|
||||
if (!ctype_alnum($c) && strpos('@_-.', $c) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return php mail extra params to use for invoker->mail.
|
||||
*
|
||||
|
|
@ -249,7 +285,11 @@ class Swift_Transport_MailTransport implements Swift_Transport
|
|||
private function _formatExtraParams($extraParams, $reversePath)
|
||||
{
|
||||
if (false !== strpos($extraParams, '-f%s')) {
|
||||
$extraParams = empty($reversePath) ? str_replace('-f%s', '', $extraParams) : sprintf($extraParams, escapeshellarg($reversePath));
|
||||
if (empty($reversePath) || false === $this->_isShellSafe($reversePath)) {
|
||||
$extraParams = str_replace('-f%s', '', $extraParams);
|
||||
} else {
|
||||
$extraParams = sprintf($extraParams, $reversePath);
|
||||
}
|
||||
}
|
||||
|
||||
return !empty($extraParams) ? $extraParams : null;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class Swift_Transport_SendmailTransport extends Swift_Transport_AbstractSmtpTran
|
|||
*
|
||||
* @param string $command
|
||||
*
|
||||
* @return Swift_Transport_SendmailTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setCommand($command)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class Swift_Transport_SpoolTransport implements Swift_Transport
|
|||
*
|
||||
* @param Swift_Spool $spool
|
||||
*
|
||||
* @return Swift_Transport_SpoolTransport
|
||||
* @return $this
|
||||
*/
|
||||
public function setSpool(Swift_Spool $spool)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
|
|||
if ($this->_stream) {
|
||||
stream_set_blocking($this->_stream, 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$this->_params[$param] = $value;
|
||||
|
|
@ -292,6 +291,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
|
|||
1 => array('pipe', 'w'),
|
||||
2 => array('pipe', 'w'),
|
||||
);
|
||||
$pipes = array();
|
||||
$this->_stream = proc_open($command, $descriptorSpec, $pipes);
|
||||
stream_set_blocking($pipes[2], 0);
|
||||
if ($err = stream_get_contents($pipes[2])) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ Swift_DependencyContainer::getInstance()
|
|||
// As of PHP 5.4.7, the quoted_printable_encode() function behaves correctly.
|
||||
// see https://github.com/php/php-src/commit/18bb426587d62f93c54c40bf8535eb8416603629
|
||||
->register('mime.qpcontentencoder')
|
||||
->asAliasOf(version_compare(phpversion(), '5.4.7', '>=') ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder')
|
||||
->asAliasOf(PHP_VERSION_ID >= 50407 ? 'mime.qpcontentencoderproxy' : 'mime.safeqpcontentencoder')
|
||||
;
|
||||
|
||||
unset($swift_mime_types);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,6 @@ if (@is_writable($tmpDir = sys_get_temp_dir())) {
|
|||
|
||||
// this should only be done when Swiftmailer won't use the native QP content encoder
|
||||
// see mime_deps.php
|
||||
if (version_compare(phpversion(), '5.4.7', '<')) {
|
||||
if (PHP_VERSION_ID < 50407) {
|
||||
$preferences->setQPDotEscape(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
<ini name="intl.default_locale" value="en"/>
|
||||
<ini name="intl.error_level" value="0"/>
|
||||
<ini name="memory_limit" value="-1"/>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
</php>
|
||||
|
||||
<testsuites>
|
||||
|
|
@ -32,6 +33,7 @@
|
|||
</testsuites>
|
||||
|
||||
<listeners>
|
||||
<listener class="Mockery\Adapter\Phpunit\TestListener"/>
|
||||
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
|
||||
<listener class="Mockery\Adapter\Phpunit\TestListener" />
|
||||
</listeners>
|
||||
</phpunit>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
class SwiftMailerSmokeTestCase extends SwiftMailerTestCase
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_SMOKE_TRANSPORT_TYPE')) {
|
||||
$this->markTestSkipped(
|
||||
|
|
|
|||
|
|
@ -12,13 +12,6 @@
|
|||
You can fill out only the parts you know and leave the other bits.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
Defines: The path to a writable directory (a temporary dir).
|
||||
Recommended: /tmp
|
||||
*/
|
||||
define('SWIFT_TMP_DIR', '/tmp');
|
||||
|
||||
/*
|
||||
Defines: The name and port of a SMTP server you can connect to.
|
||||
Recommended: smtp.gmail.com:25
|
||||
|
|
|
|||
|
|
@ -2,24 +2,15 @@
|
|||
|
||||
class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $_tmpDir;
|
||||
private $_testFile;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_TMP_DIR')) {
|
||||
$this->markTestSkipped(
|
||||
'Cannot run test without a writable directory to use ('.
|
||||
'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_tmpDir = SWIFT_TMP_DIR;
|
||||
$this->_testFile = $this->_tmpDir.'/swift-test-file'.__CLASS__;
|
||||
$this->_testFile = sys_get_temp_dir().'/swift-test-file'.__CLASS__;
|
||||
file_put_contents($this->_testFile, 'abcdefghijklm');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
unlink($this->_testFile);
|
||||
}
|
||||
|
|
@ -50,18 +41,14 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
|
|||
|
||||
public function testFileCanBeWrittenTo()
|
||||
{
|
||||
$file = $this->_createFileStream(
|
||||
$this->_testFile, true
|
||||
);
|
||||
$file = $this->_createFileStream($this->_testFile, true);
|
||||
$file->write('foobar');
|
||||
$this->assertEquals('foobar', $file->read(8192));
|
||||
}
|
||||
|
||||
public function testReadingFromThenWritingToFile()
|
||||
{
|
||||
$file = $this->_createFileStream(
|
||||
$this->_testFile, true
|
||||
);
|
||||
$file = $this->_createFileStream($this->_testFile, true);
|
||||
$file->write('foobar');
|
||||
$this->assertEquals('foobar', $file->read(8192));
|
||||
$file->write('zipbutton');
|
||||
|
|
@ -70,9 +57,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
|
|||
|
||||
public function testWritingToFileWithCanonicalization()
|
||||
{
|
||||
$file = $this->_createFileStream(
|
||||
$this->_testFile, true
|
||||
);
|
||||
$file = $this->_createFileStream($this->_testFile, true);
|
||||
$file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF');
|
||||
$file->write("foo\r\nbar\r");
|
||||
$file->write("\nzip\r\ntest\r");
|
||||
|
|
@ -80,11 +65,18 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
|
|||
$this->assertEquals("foo\nbar\nzip\ntest\n", file_get_contents($this->_testFile));
|
||||
}
|
||||
|
||||
public function testWritingWithFulleMessageLengthOfAMultipleOf8192()
|
||||
{
|
||||
$file = $this->_createFileStream($this->_testFile, true);
|
||||
$file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF');
|
||||
$file->write('');
|
||||
$file->flushBuffers();
|
||||
$this->assertEquals('', file_get_contents($this->_testFile));
|
||||
}
|
||||
|
||||
public function testBindingOtherStreamsMirrorsWriteOperations()
|
||||
{
|
||||
$file = $this->_createFileStream(
|
||||
$this->_testFile, true
|
||||
);
|
||||
$file = $this->_createFileStream($this->_testFile, true);
|
||||
$is1 = $this->_createMockInputStream();
|
||||
$is2 = $this->_createMockInputStream();
|
||||
|
||||
|
|
@ -129,9 +121,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
|
|||
|
||||
public function testUnbindingStreamPreventsFurtherWrites()
|
||||
{
|
||||
$file = $this->_createFileStream(
|
||||
$this->_testFile, true
|
||||
);
|
||||
$file = $this->_createFileStream($this->_testFile, true);
|
||||
$is1 = $this->_createMockInputStream();
|
||||
$is2 = $this->_createMockInputStream();
|
||||
|
||||
|
|
@ -155,8 +145,6 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
|
|||
$file->write('y');
|
||||
}
|
||||
|
||||
// -- Creation methods
|
||||
|
||||
private function _createFilter($search, $replace)
|
||||
{
|
||||
return new Swift_StreamFilters_StringReplacementFilter($search, $replace);
|
||||
|
|
@ -164,7 +152,7 @@ class Swift_ByteStream_FileByteStreamAcceptanceTest extends \PHPUnit_Framework_T
|
|||
|
||||
private function _createMockInputStream()
|
||||
{
|
||||
return $this->getMock('Swift_InputByteStream');
|
||||
return $this->getMockBuilder('Swift_InputByteStream')->getMock();
|
||||
}
|
||||
|
||||
private function _createFileStream($file, $writable = false)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
private $_factory;
|
||||
private $_prefix = 'Swift_CharacterReader_';
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
|
||||
}
|
||||
|
|
@ -14,7 +14,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) {
|
||||
$reader = $this->_factory->getReaderFor($utf8);
|
||||
$this->assertInstanceof($this->_prefix.'Utf8Reader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'Utf8Reader', $reader);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
|
||||
foreach ($charsets as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -49,7 +49,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
|
||||
foreach ($charsets as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
|
||||
foreach ($charsets as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('ansi', 'ANSI') as $ansi) {
|
||||
$reader = $this->_factory->getReaderFor($ansi);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('macintosh', 'MACINTOSH') as $mac) {
|
||||
$reader = $this->_factory->getReaderFor($mac);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
|
||||
foreach ($charsets as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -118,7 +118,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('mik', 'MIK') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('cork', 'CORK', 't1', 'T1') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(1, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(2, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -154,7 +154,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(2, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(4, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ class Swift_CharacterReaderFactory_SimpleCharacterReaderFactoryAcceptanceTest ex
|
|||
{
|
||||
foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) {
|
||||
$reader = $this->_factory->getReaderFor($charset);
|
||||
$this->assertInstanceof($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertInstanceOf($this->_prefix.'GenericFixedWidthReader', $reader);
|
||||
$this->assertEquals(4, $reader->getInitialByteSize());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,10 @@ class Swift_DependencyContainerAcceptanceTest extends \PHPUnit_Framework_TestCas
|
|||
$di = Swift_DependencyContainer::getInstance();
|
||||
foreach ($di->listItems() as $itemName) {
|
||||
try {
|
||||
// to be removed in 6.0
|
||||
if ('transport.mail' === $itemName) {
|
||||
continue;
|
||||
}
|
||||
$di->lookup($itemName);
|
||||
} catch (Swift_DependencyException $e) {
|
||||
$this->fail($e->getMessage());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Swift_Encoder_Base64EncoderAcceptanceTest extends \PHPUnit_Framework_TestC
|
|||
private $_samplesDir;
|
||||
private $_encoder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
|
||||
$this->_encoder = new Swift_Encoder_Base64Encoder();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Swift_Encoder_QpEncoderAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
private $_samplesDir;
|
||||
private $_factory;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
|
||||
$this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Swift_Encoder_Rfc2231EncoderAcceptanceTest extends \PHPUnit_Framework_Test
|
|||
private $_samplesDir;
|
||||
private $_factory;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../_samples/charsets');
|
||||
$this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Swift_KeyCache_ArrayKeyCacheAcceptanceTest extends \PHPUnit_Framework_Test
|
|||
private $_key1 = 'key1';
|
||||
private $_key2 = 'key2';
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_cache = new Swift_KeyCache_ArrayKeyCache(
|
||||
new Swift_KeyCache_SimpleKeyCacheInputStream()
|
||||
|
|
|
|||
|
|
@ -6,21 +6,11 @@ class Swift_KeyCache_DiskKeyCacheAcceptanceTest extends \PHPUnit_Framework_TestC
|
|||
private $_key1;
|
||||
private $_key2;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_TMP_DIR')) {
|
||||
$this->markTestSkipped(
|
||||
'Cannot run test without a writable directory to use ('.
|
||||
'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_key1 = uniqid(microtime(true), true);
|
||||
$this->_key2 = uniqid(microtime(true), true);
|
||||
$this->_cache = new Swift_KeyCache_DiskKeyCache(
|
||||
new Swift_KeyCache_SimpleKeyCacheInputStream(),
|
||||
SWIFT_TMP_DIR
|
||||
);
|
||||
$this->_cache = new Swift_KeyCache_DiskKeyCache(new Swift_KeyCache_SimpleKeyCacheInputStream(), sys_get_temp_dir());
|
||||
}
|
||||
|
||||
public function testStringDataCanBeSetAndFetched()
|
||||
|
|
|
|||
|
|
@ -45,8 +45,6 @@ class Swift_MessageAcceptanceTest extends Swift_Mime_SimpleMessageAcceptanceTest
|
|||
);
|
||||
}
|
||||
|
||||
// -- Private helpers
|
||||
|
||||
protected function _createMessage()
|
||||
{
|
||||
Swift_DependencyContainer::getInstance()
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
private $_grammar;
|
||||
private $_headers;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_cache = new Swift_KeyCache_ArrayKeyCache(
|
||||
new Swift_KeyCache_SimpleKeyCacheInputStream()
|
||||
|
|
@ -109,8 +109,6 @@ class Swift_Mime_AttachmentAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
// -- Private helpers
|
||||
|
||||
protected function _createAttachment()
|
||||
{
|
||||
$entity = new Swift_Mime_Attachment(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_Base64ContentEncoderAcceptanceTest extends \PHPU
|
|||
private $_samplesDir;
|
||||
private $_encoder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
|
||||
$this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH
|
|||
*/
|
||||
protected $_encoder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
|
||||
$this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder();
|
||||
|
|
@ -65,7 +65,7 @@ class Swift_Mime_ContentEncoder_NativeQpContentEncoderAcceptanceTest extends \PH
|
|||
}
|
||||
|
||||
/**
|
||||
* @expectedException RuntimeException
|
||||
* @expectedException \RuntimeException
|
||||
*/
|
||||
public function testCharsetChangeNotImplemented()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class Swift_Mime_ContentEncoder_PlainContentEncoderAcceptanceTest extends \PHPUn
|
|||
private $_samplesDir;
|
||||
private $_encoder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
|
||||
$this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit');
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ class Swift_Mime_ContentEncoder_QpContentEncoderAcceptanceTest extends \PHPUnit_
|
|||
private $_samplesDir;
|
||||
private $_factory;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_samplesDir = realpath(__DIR__.'/../../../../_samples/charsets');
|
||||
$this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
Swift_Preferences::getInstance()->setQPDotEscape(false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
private $_grammar;
|
||||
private $_headers;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_cache = new Swift_KeyCache_ArrayKeyCache(
|
||||
new Swift_KeyCache_SimpleKeyCacheInputStream()
|
||||
|
|
@ -122,8 +122,6 @@ class Swift_Mime_EmbeddedFileAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
// -- Private helpers
|
||||
|
||||
protected function _createEmbeddedFile()
|
||||
{
|
||||
$entity = new Swift_Mime_EmbeddedFile(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Swift_Mime_HeaderEncoder_Base64HeaderEncoderAcceptanceTest extends \PHPUni
|
|||
{
|
||||
private $_encoder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
private $_grammar;
|
||||
private $_headers;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_cache = new Swift_KeyCache_ArrayKeyCache(
|
||||
new Swift_KeyCache_SimpleKeyCacheInputStream()
|
||||
|
|
@ -113,8 +113,6 @@ class Swift_Mime_MimePartAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
// -- Private helpers
|
||||
|
||||
protected function _createMimePart()
|
||||
{
|
||||
$entity = new Swift_Mime_MimePart(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
Swift_Preferences::getInstance()->setCharset(null); //TODO: Test with the charset defined
|
||||
}
|
||||
|
|
@ -1227,8 +1227,6 @@ class Swift_Mime_SimpleMessageAcceptanceTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
// -- Private helpers
|
||||
|
||||
protected function _createMessage()
|
||||
{
|
||||
return new Swift_Message();
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
<?php
|
||||
|
||||
abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
extends \PHPUnit_Framework_TestCase
|
||||
abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected $_buffer;
|
||||
|
||||
abstract protected function _initializeBuffer();
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (true == getenv('TRAVIS')) {
|
||||
$this->markTestSkipped(
|
||||
|
|
@ -17,7 +16,7 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
|||
}
|
||||
|
||||
$this->_buffer = new Swift_Transport_StreamBuffer(
|
||||
$this->getMock('Swift_ReplacementFilterFactory')
|
||||
$this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -125,10 +124,8 @@ abstract class Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
|||
$this->_buffer->write('y');
|
||||
}
|
||||
|
||||
// -- Creation Methods
|
||||
|
||||
private function _createMockInputStream()
|
||||
{
|
||||
return $this->getMock('Swift_InputByteStream');
|
||||
return $this->getMockBuilder('Swift_InputByteStream')->getMock();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
|
||||
|
||||
class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest
|
||||
extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
class Swift_Transport_StreamBuffer_BasicSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_SMTP_HOST')) {
|
||||
$this->markTestSkipped(
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
|
||||
|
||||
class Swift_Transport_StreamBuffer_ProcessAcceptanceTest
|
||||
extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
class Swift_Transport_StreamBuffer_ProcessAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_SENDMAIL_PATH')) {
|
||||
$this->markTestSkipped(
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_
|
|||
|
||||
protected $_server;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_SMTP_HOST')) {
|
||||
$this->markTestSkipped(
|
||||
|
|
@ -27,7 +27,7 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_
|
|||
}
|
||||
|
||||
$this->_buffer = new Swift_Transport_StreamBuffer(
|
||||
$this->getMock('Swift_ReplacementFilterFactory')
|
||||
$this->getMockBuilder('Swift_ReplacementFilterFactory')->getMock()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -54,11 +54,11 @@ class Swift_Transport_StreamBuffer_SocketTimeoutTest extends \PHPUnit_Framework_
|
|||
$line = $this->_buffer->readLine(0);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
$this->assertInstanceof('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout');
|
||||
$this->assertInstanceOf('Swift_IoException', $e, 'IO Exception Not Thrown On Connection Timeout');
|
||||
$this->assertRegExp('/Connection to .* Timed Out/', $e->getMessage());
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
if ($this->_server) {
|
||||
stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR);
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
|
||||
|
||||
class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest
|
||||
extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
class Swift_Transport_StreamBuffer_SslSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$streams = stream_get_transports();
|
||||
if (!in_array('ssl', $streams)) {
|
||||
|
|
|
|||
|
|
@ -2,10 +2,9 @@
|
|||
|
||||
require_once __DIR__.'/AbstractStreamBufferAcceptanceTest.php';
|
||||
|
||||
class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest
|
||||
extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
class Swift_Transport_StreamBuffer_TlsSocketAcceptanceTest extends Swift_Transport_StreamBuffer_AbstractStreamBufferAcceptanceTest
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$streams = stream_get_transports();
|
||||
if (!in_array('tls', $streams)) {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Swift_Bug118Test extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
private $_message;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_message = new Swift_Message();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Swift_Bug206Test extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
private $_factory;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory();
|
||||
$headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder(
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Swift_Bug34Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
Swift_Preferences::getInstance()->setCharset('utf-8');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
class Swift_Bug35Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
Swift_Preferences::getInstance()->setCharset('utf-8');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
|
|||
private $_attFileName;
|
||||
private $_attFileType;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_attFileName = 'data.txt';
|
||||
$this->_attFileType = 'text/plain';
|
||||
|
|
@ -181,8 +181,6 @@ class Swift_Bug38Test extends \PHPUnit_Framework_TestCase
|
|||
$this->assertPatternInStream($pattern, $streamB);
|
||||
}
|
||||
|
||||
// -- Helpers
|
||||
|
||||
public function assertPatternInStream($pattern, $stream, $message = '%s')
|
||||
{
|
||||
$string = '';
|
||||
|
|
|
|||
|
|
@ -5,23 +5,16 @@ class Swift_Bug51Test extends \SwiftMailerTestCase
|
|||
private $_attachmentFile;
|
||||
private $_outputFile;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) {
|
||||
$this->markTestSkipped(
|
||||
'Cannot run test without a writable directory to use ('.
|
||||
'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_attachmentFile = SWIFT_TMP_DIR.'/attach.rand.bin';
|
||||
$this->_attachmentFile = sys_get_temp_dir().'/attach.rand.bin';
|
||||
file_put_contents($this->_attachmentFile, '');
|
||||
|
||||
$this->_outputFile = SWIFT_TMP_DIR.'/attach.out.bin';
|
||||
$this->_outputFile = sys_get_temp_dir().'/attach.out.bin';
|
||||
file_put_contents($this->_outputFile, '');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
unlink($this->_attachmentFile);
|
||||
unlink($this->_outputFile);
|
||||
|
|
@ -66,8 +59,6 @@ class Swift_Bug51Test extends \SwiftMailerTestCase
|
|||
}
|
||||
}
|
||||
|
||||
// -- Custom Assertions
|
||||
|
||||
public function assertAttachmentFromSourceMatches($attachmentData, $source)
|
||||
{
|
||||
$encHeader = 'Content-Transfer-Encoding: base64';
|
||||
|
|
@ -88,8 +79,6 @@ class Swift_Bug51Test extends \SwiftMailerTestCase
|
|||
$this->assertIdenticalBinary($attachmentData, base64_decode($attachmentBase64));
|
||||
}
|
||||
|
||||
// -- Creation Methods
|
||||
|
||||
private function _fillFileWithRandomBytes($byteCount, $file)
|
||||
{
|
||||
// I was going to use dd with if=/dev/random but this way seems more
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class Swift_Bug71Test extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
private $_message;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_message = new Swift_Message('test');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,25 +6,18 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
|
|||
private $_outputFile;
|
||||
private $_encoder;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
if (!defined('SWIFT_TMP_DIR') || !is_writable(SWIFT_TMP_DIR)) {
|
||||
$this->markTestSkipped(
|
||||
'Cannot run test without a writable directory to use ('.
|
||||
'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)'
|
||||
);
|
||||
}
|
||||
|
||||
$this->_inputFile = SWIFT_TMP_DIR.'/in.bin';
|
||||
$this->_inputFile = sys_get_temp_dir().'/in.bin';
|
||||
file_put_contents($this->_inputFile, '');
|
||||
|
||||
$this->_outputFile = SWIFT_TMP_DIR.'/out.bin';
|
||||
$this->_outputFile = sys_get_temp_dir().'/out.bin';
|
||||
file_put_contents($this->_outputFile, '');
|
||||
|
||||
$this->_encoder = $this->_createEncoder();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
protected function tearDown()
|
||||
{
|
||||
unlink($this->_inputFile);
|
||||
unlink($this->_outputFile);
|
||||
|
|
@ -44,8 +37,6 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
// -- Custom Assertions
|
||||
|
||||
public function assertMaxLineLength($length, $filePath, $message = '%s')
|
||||
{
|
||||
$lines = file($filePath);
|
||||
|
|
@ -54,8 +45,6 @@ class Swift_Bug76Test extends \PHPUnit_Framework_TestCase
|
|||
}
|
||||
}
|
||||
|
||||
// -- Creation Methods
|
||||
|
||||
private function _fillFileWithRandomBytes($byteCount, $file)
|
||||
{
|
||||
// I was going to use dd with if=/dev/random but this way seems more
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
|
||||
class Swift_FileByteStreamConsecutiveReadCalls extends \PHPUnit_Framework_TestCase
|
||||
class Swift_FileByteStreamConsecutiveReadCalls extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
|
|
|
|||
|
|
@ -32,27 +32,35 @@ class MimeEntityFixture implements Swift_Mime_MimeEntity
|
|||
public function getId()
|
||||
{
|
||||
}
|
||||
|
||||
public function getHeaders()
|
||||
{
|
||||
}
|
||||
|
||||
public function getBody()
|
||||
{
|
||||
}
|
||||
|
||||
public function setBody($body, $contentType = null)
|
||||
{
|
||||
}
|
||||
|
||||
public function toByteStream(Swift_InputByteStream $is)
|
||||
{
|
||||
}
|
||||
|
||||
public function charsetChanged($charset)
|
||||
{
|
||||
}
|
||||
|
||||
public function encoderChanged(Swift_Mime_ContentEncoder $encoder)
|
||||
{
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
}
|
||||
|
||||
public function setChildren(array $children)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Swift_Smoke_AttachmentSmokeTest extends SwiftMailerSmokeTestCase
|
|||
{
|
||||
private $_attFile;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setup(); // For skip
|
||||
$this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class Swift_Smoke_HtmlWithAttachmentSmokeTest extends SwiftMailerSmokeTestCase
|
|||
{
|
||||
private $_attFile;
|
||||
|
||||
public function setUp()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->_attFile = __DIR__.'/../../../_samples/files/textfile.zip';
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue