Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"php": ">=5.3.3"
"php": "^7.4 || ^8.0"
},
"require-dev": {
"mockery/mockery": "~0.9.1",
Expand Down
6 changes: 3 additions & 3 deletions lib/classes/Swift/Encoder/QpEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ protected function initSafeMap()
* If the first line needs to be shorter, indicate the difference with
* $firstLineOffset.
*
* @param string $string to encode
* @param int $firstLineOffset, optional
* @param int $maxLineLength, optional 0 indicates the default of 76 chars
* @param string $string string to encode
* @param int $firstLineOffset optional
* @param int $maxLineLength optional, 0 indicates the default of 76 chars
*
* @return string
*/
Expand Down
25 changes: 18 additions & 7 deletions lib/classes/Swift/KeyCache/SimpleKeyCacheInputStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@
*/
class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCacheInputStream
{
/** The KeyCache being written to */
/**
* @var Swift_KeyCache The KeyCache being written to
*/
private $_keyCache;

/** The nsKey of the KeyCache being written to */
/**
* @var string The nsKey of the KeyCache being written to
*/
private $_nsKey;

/** The itemKey of the KeyCache being written to */
private $_itemKey;

/** A stream to write through on each write() */
/**
* @var Swift_InputByteStream|null A stream to write through on each write()
*/
private $_writeThrough = null;

/**
Expand All @@ -51,18 +57,23 @@ public function setWriteThroughStream(Swift_InputByteStream $is)
* Writes $bytes to the end of the stream.
*
* @param string $bytes
* @param Swift_InputByteStream $is optional
* @param ?Swift_InputByteStream $is
*
* @throws Swift_IoException
*
* @return int
*/
public function write($bytes, Swift_InputByteStream $is = null)
{
$this->_keyCache->setString(
$this->_nsKey, $this->_itemKey, $bytes, Swift_KeyCache::MODE_APPEND
);
);

if (isset($is)) {
$is->write($bytes);
return $is->write($bytes);
}
if (isset($this->_writeThrough)) {
$this->_writeThrough->write($bytes);
return $this->_writeThrough->write($bytes);
}
}

Expand Down
21 changes: 17 additions & 4 deletions lib/classes/Swift/Mime/ContentEncoder/QpContentEncoderProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public function __clone()
}

/**
* {@inheritdoc}
* Notify this observer that the entity's charset has changed.
*
* @param string $charset
*/
public function charsetChanged($charset)
{
Expand All @@ -65,23 +67,34 @@ public function charsetChanged($charset)
}

/**
* {@inheritdoc}
* Encode $in to $out.
*
* @param Swift_OutputByteStream $os to read from
* @param Swift_InputByteStream $is to write to
* @param int $firstLineOffset
* @param int $maxLineLength - 0 indicates the default length for this encoding
*/
public function encodeByteStream(Swift_OutputByteStream $os, Swift_InputByteStream $is, $firstLineOffset = 0, $maxLineLength = 0)
{
$this->getEncoder()->encodeByteStream($os, $is, $firstLineOffset, $maxLineLength);
}

/**
* {@inheritdoc}
* @return string
*/
public function getName()
{
return 'quoted-printable';
}

/**
* {@inheritdoc}
* Encode a given string to produce an encoded string.
*
* @param string $string
* @param int $firstLineOffset ignored
* @param int $maxLineLength - 0 means no wrapping will occur
*
* @return string
*/
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
{
Expand Down
4 changes: 2 additions & 2 deletions lib/classes/Swift/Transport/Esmtp/AuthHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
/**
* The auth mode for authentication.
*
* @var string
* @var string|null
*/
private $_auth_mode;

Expand Down Expand Up @@ -248,7 +248,7 @@ public function resetState()
*/
protected function _getAuthenticatorsForAgent()
{
if (!$mode = strtolower($this->_auth_mode)) {
if (!$this->_auth_mode || !$mode = strtolower($this->_auth_mode)) {
return $this->_authenticators;
}

Expand Down
8 changes: 4 additions & 4 deletions lib/classes/Swift/Transport/EsmtpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@ public function getTimeout()
/**
* Set the encryption type (tls or ssl).
*
* @param string $encryption
* @param string|null $encryption
*
* @return $this
*/
public function setEncryption($encryption)
{
$encryption = strtolower($encryption);
if ('tls' == $encryption) {
$normalizedEncryption = $encryption ? strtolower($encryption) : '';
if ('tls' === $normalizedEncryption) {
$this->_params['protocol'] = 'tcp';
$this->_params['tls'] = true;
} else {
$this->_params['protocol'] = $encryption;
$this->_params['protocol'] = $normalizedEncryption;
$this->_params['tls'] = false;
}

Expand Down