From 9890f290326e05fcd2ea40be4242d4b7e574b1db Mon Sep 17 00:00:00 2001 From: Richard Brinkman Date: Fri, 25 Feb 2022 12:11:24 +0100 Subject: [PATCH 1/2] Del: deprecation warning --- Mail.php | 2 +- Mail/smtp.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Mail.php b/Mail.php index b04bc01..f1b9476 100644 --- a/Mail.php +++ b/Mail.php @@ -153,7 +153,7 @@ protected function _sanitizeHeaders(&$headers) foreach ($headers as $key => $value) { $headers[$key] = preg_replace('=((||0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i', - null, $value); + '', $value); } } diff --git a/Mail/smtp.php b/Mail/smtp.php index 5e698fe..0b81d5e 100644 --- a/Mail/smtp.php +++ b/Mail/smtp.php @@ -38,7 +38,7 @@ * * @category HTTP * @package HTTP_Request - * @author Jon Parise + * @author Jon Parise * @author Chuck Hagenbuch * @copyright 2010-2017 Chuck Hagenbuch * @license http://opensource.org/licenses/BSD-3-Clause New BSD License @@ -305,7 +305,7 @@ protected function send_or_fail($recipients, $headers, $body) $params .= ' ' . $key . (is_null($val) ? '' : '=' . $val); } } - if (PEAR::isError($res = $this->_smtp->mailFrom($from, ltrim($params)))) { + if (PEAR::isError($res = $this->_smtp->mailFrom($from, ltrim($params ?? '')))) { $error = $this->_error("Failed to set sender: $from", $res); $this->_smtp->rset(); return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_SENDER); From d53f7207f35ac49a33c9a981bc3d5b7cbbfe8f53 Mon Sep 17 00:00:00 2001 From: richardbrinkman Date: Fri, 25 Feb 2022 18:46:17 +0100 Subject: [PATCH 2/2] Fix: PHP 5 compatible change to prevent E_DEPRECATED warnings --- Mail/smtp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Mail/smtp.php b/Mail/smtp.php index 0b81d5e..5556355 100644 --- a/Mail/smtp.php +++ b/Mail/smtp.php @@ -299,13 +299,13 @@ protected function send_or_fail($recipients, $headers, $body) PEAR_MAIL_SMTP_ERROR_FROM); } - $params = null; + $params = ''; if (!empty($this->_extparams)) { foreach ($this->_extparams as $key => $val) { $params .= ' ' . $key . (is_null($val) ? '' : '=' . $val); } } - if (PEAR::isError($res = $this->_smtp->mailFrom($from, ltrim($params ?? '')))) { + if (PEAR::isError($res = $this->_smtp->mailFrom($from, ltrim($params)))) { $error = $this->_error("Failed to set sender: $from", $res); $this->_smtp->rset(); return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_SENDER);