Skip to content

Commit 0388ecb

Browse files
committed
Fix strtolower() deprecation when invoked with NULL
1 parent 4cb6b54 commit 0388ecb

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/classes/Swift/Transport/Esmtp/AuthHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Swift_Transport_Esmtp_AuthHandler implements Swift_Transport_EsmtpHandler
3939
/**
4040
* The auth mode for authentication.
4141
*
42-
* @var string
42+
* @var string|null
4343
*/
4444
private $_auth_mode;
4545

@@ -248,7 +248,7 @@ public function resetState()
248248
*/
249249
protected function _getAuthenticatorsForAgent()
250250
{
251-
if (!$mode = strtolower($this->_auth_mode)) {
251+
if (!$this->_auth_mode || !$mode = strtolower($this->_auth_mode)) {
252252
return $this->_authenticators;
253253
}
254254

lib/classes/Swift/Transport/EsmtpTransport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,18 @@ public function getTimeout()
134134
/**
135135
* Set the encryption type (tls or ssl).
136136
*
137-
* @param string $encryption
137+
* @param string|null $encryption
138138
*
139139
* @return $this
140140
*/
141141
public function setEncryption($encryption)
142142
{
143-
$encryption = strtolower($encryption);
144-
if ('tls' == $encryption) {
143+
$normalizedEncryption = $encryption ? strtolower($encryption) : '';
144+
if ('tls' === $normalizedEncryption) {
145145
$this->_params['protocol'] = 'tcp';
146146
$this->_params['tls'] = true;
147147
} else {
148-
$this->_params['protocol'] = $encryption;
148+
$this->_params['protocol'] = $normalizedEncryption;
149149
$this->_params['tls'] = false;
150150
}
151151

0 commit comments

Comments
 (0)