Fix null connection issue introduced in #2060
This commit is contained in:
parent
b52fd6e8ad
commit
b3650f9f72
|
|
@ -1,5 +1,8 @@
|
|||
# PHPMailer Change Log
|
||||
|
||||
## WIP
|
||||
* Split SMTP connection into two separate methods
|
||||
|
||||
## Version 6.1.6 (May 27th, 2020)
|
||||
* **SECURITY** Fix insufficient output escaping bug in file attachment names. CVE-2020-13625. Reported by Elar Lang of Clarified Security.
|
||||
* Correct Armenian ISO language code from `am` to `hy`, add mapping for fallback
|
||||
|
|
|
|||
27
src/SMTP.php
27
src/SMTP.php
|
|
@ -332,17 +332,13 @@ class SMTP
|
|||
|
||||
$this->smtp_conn = $this->getSMTPConnection($host, $port, $timeout, $options);
|
||||
|
||||
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
||||
// SMTP server can take longer to respond, give longer timeout for first read
|
||||
// Windows does not have support for this timeout function
|
||||
if (strpos(PHP_OS, 'WIN') !== 0) {
|
||||
$max = (int) ini_get('max_execution_time');
|
||||
// Don't bother if unlimited
|
||||
if (0 !== $max && $timeout > $max) {
|
||||
@set_time_limit($timeout);
|
||||
}
|
||||
stream_set_timeout($this->smtp_conn, $timeout, 0);
|
||||
if ($this->smtp_conn === false) {
|
||||
//Error info already set inside `getSMTPConnection()`
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->edebug('Connection: opened', self::DEBUG_CONNECTION);
|
||||
|
||||
// Get any announcement
|
||||
$announce = $this->get_lines();
|
||||
$this->edebug('SERVER -> CLIENT: ' . $announce, self::DEBUG_SERVER);
|
||||
|
|
@ -417,6 +413,17 @@ class SMTP
|
|||
return false;
|
||||
}
|
||||
|
||||
// SMTP server can take longer to respond, give longer timeout for first read
|
||||
// Windows does not have support for this timeout function
|
||||
if (strpos(PHP_OS, 'WIN') !== 0) {
|
||||
$max = (int)ini_get('max_execution_time');
|
||||
// Don't bother if unlimited
|
||||
if (0 !== $max && $timeout > $max) {
|
||||
@set_time_limit($timeout);
|
||||
}
|
||||
stream_set_timeout($connection, $timeout, 0);
|
||||
}
|
||||
|
||||
return $connection;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue