commit
099f47deba
@ -288,7 +288,8 @@ script:
|
||||
echo "Checking PHP syntax errors"
|
||||
# Ensure we catch errors
|
||||
set -e
|
||||
parallel-lint --exclude htdocs/includes --blame .
|
||||
#parallel-lint --exclude htdocs/includes --blame .
|
||||
parallel-lint --exclude htdocs/includes/sabre --exclude htdocs/includes/squizlabs/php_codesniffer/tests --exclude htdocs/includes/jakub-onderka/php-parallel-lint/tests --exclude htdocs/includes/mike42/escpos-php/example --exclude htdocs/includes/phpunit/php-token-stream/tests --exclude htdocs/includes/composer/autoload_static.php --blame .
|
||||
set +e
|
||||
echo
|
||||
|
||||
|
||||
@ -22,7 +22,8 @@ class NoRFCWarningsValidation extends RFCValidation
|
||||
return false;
|
||||
}
|
||||
|
||||
if (empty($this->getWarnings())) {
|
||||
$ret = $this->getWarnings();
|
||||
if (empty($ret)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -13,10 +13,10 @@ class SpoofCheckValidation implements EmailValidation
|
||||
* @var InvalidEmail
|
||||
*/
|
||||
private $error;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (!class_exists(Spoofchecker::class)) {
|
||||
if (!extension_loaded('intl')) {
|
||||
throw new \LogicException(sprintf('The %s class requires the Intl extension.', __CLASS__));
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
}
|
||||
$this->offset += ($i - $this->offset); // Limit function calls
|
||||
|
||||
return array_merge(...$arrays);
|
||||
return call_user_func_array('array_merge', $arrays);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -97,7 +97,7 @@ class Swift_Mime_Headers_ParameterizedHeader extends Swift_Mime_Headers_Unstruct
|
||||
{
|
||||
$params = $this->getParameters();
|
||||
|
||||
return $params[$parameter] ?? null;
|
||||
return isset($params[$parameter]) ? $params[$parameter] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -46,7 +46,7 @@ class Swift_Mime_IdGenerator implements Swift_IdGenerator
|
||||
*/
|
||||
public function generateId()
|
||||
{
|
||||
$idLeft = bin2hex(random_bytes(16)); // set 32 hex values
|
||||
$idLeft = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
|
||||
|
||||
return $idLeft.'@'.$this->idRight;
|
||||
}
|
||||
|
||||
@ -493,7 +493,7 @@ class Swift_Mime_SimpleMessage extends Swift_Mime_MimePart
|
||||
'%[1-5]'
|
||||
);
|
||||
|
||||
return $priority ?? 3;
|
||||
return isset($priority) ? $priority : 3;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -92,7 +92,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
|
||||
*/
|
||||
public function __construct(Swift_Mime_SimpleHeaderSet $headers, Swift_Mime_ContentEncoder $encoder, Swift_KeyCache $cache, Swift_IdGenerator $idGenerator)
|
||||
{
|
||||
$this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
|
||||
$this->cacheKey = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
|
||||
$this->cache = $cache;
|
||||
$this->headers = $headers;
|
||||
$this->idGenerator = $idGenerator;
|
||||
@ -293,7 +293,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
|
||||
public function setChildren(array $children, $compoundLevel = null)
|
||||
{
|
||||
// TODO: Try to refactor this logic
|
||||
$compoundLevel = $compoundLevel ?? $this->getCompoundLevel($children);
|
||||
$compoundLevel = isset($compoundLevel) ? $compoundLevel : $this->getCompoundLevel($children);
|
||||
$immediateChildren = array();
|
||||
$grandchildren = array();
|
||||
$newContentType = $this->userContentType;
|
||||
@ -420,7 +420,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
|
||||
public function getBoundary()
|
||||
{
|
||||
if (!isset($this->boundary)) {
|
||||
$this->boundary = '_=_swift_'.time().'_'.bin2hex(random_bytes(16)).'_=_';
|
||||
$this->boundary = '_=_swift_'.time().'_'.md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true)).'_=_';
|
||||
}
|
||||
|
||||
return $this->boundary;
|
||||
@ -813,7 +813,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_CharsetObserver, Swift_M
|
||||
{
|
||||
$this->headers = clone $this->headers;
|
||||
$this->encoder = clone $this->encoder;
|
||||
$this->cacheKey = bin2hex(random_bytes(16)); // set 32 hex values
|
||||
$this->cacheKey = md5(getmypid().'.'.time().'.'.uniqid(mt_rand(), true));
|
||||
$children = array();
|
||||
foreach ($this->children as $pos => $child) {
|
||||
$children[$pos] = clone $child;
|
||||
|
||||
@ -159,7 +159,7 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
|
||||
return $this->replacements->getReplacementsFor($address);
|
||||
}
|
||||
|
||||
return $this->replacements[$address] ?? null;
|
||||
return isset($this->replacements[$address]) ? $this->replacements[$address] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -278,7 +278,7 @@ class Swift_Signers_SMimeSigner implements Swift_Signers_BodySigner
|
||||
$args[] = $this->extraCerts;
|
||||
}
|
||||
|
||||
if (!openssl_pkcs7_sign(...$args)) {
|
||||
if (!call_user_func_array('openssl_pkcs7_sign', $args)) {
|
||||
throw new Swift_IoException(sprintf('Failed to sign S/Mime message. Error: "%s".', openssl_error_string()));
|
||||
}
|
||||
|
||||
|
||||
@ -58,7 +58,7 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
||||
|
||||
// extra parameters for our unit cases
|
||||
$timestamp = func_num_args() > 3 ? func_get_arg(3) : $this->getCorrectTimestamp(bcmul(microtime(true), '1000'));
|
||||
$client = func_num_args() > 4 ? func_get_arg(4) : random_bytes(8);
|
||||
$client = func_num_args() > 4 ? func_get_arg(4) : $this->getRandomBytes(8);
|
||||
|
||||
// Message 3 response
|
||||
$this->sendMessage3($response, $username, $password, $timestamp, $client, $agent);
|
||||
@ -548,6 +548,22 @@ class Swift_Transport_Esmtp_Auth_NTLMAuthenticator implements Swift_Transport_Es
|
||||
return $byte;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create random bytes.
|
||||
*
|
||||
* @param $length
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getRandomBytes($length)
|
||||
{
|
||||
$bytes = openssl_random_pseudo_bytes($length, $strong);
|
||||
if (false !== $bytes && true === $strong) {
|
||||
return $bytes;
|
||||
}
|
||||
throw new RuntimeException('OpenSSL did not produce a secure random number.');
|
||||
}
|
||||
|
||||
/** ENCRYPTION ALGORITHMS */
|
||||
|
||||
/**
|
||||
|
||||
@ -208,7 +208,7 @@ class Swift_Transport_EsmtpTransport extends Swift_Transport_AbstractSmtpTranspo
|
||||
*/
|
||||
public function getSourceIp()
|
||||
{
|
||||
return $this->params['sourceIp'] ?? null;
|
||||
return isset($this->params['sourceIp']) ? $this->params['sourceIp'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user