Skip to content

Commit

Permalink
Fix: dynamic properties deprecation (#22)
Browse files Browse the repository at this point in the history
Since PHP 8.2 dynamic properties are deprecated. See
https://www.php.net/manual/en/migration82.deprecated.php
The send_or_fail function sets a greeting variable (which is
not used anywhere) that is not a property of the Mail_smtp class.
  • Loading branch information
Richard Brinkman authored and schengawegga committed Dec 10, 2022
1 parent c31b763 commit 344577b
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Mail/smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ class Mail_smtp extends Mail {
*
* If the value is set to true, the Net_SMTP package will attempt to use
* a STARTTLS encrypted connection.
*
*
* If the value is set to false, the Net_SMTP package will avoid
* a STARTTLS encrypted connection.
*
*
* NULL indicates only STARTTLS if $auth is set.
*
*
* PEAR/Net_SMTP >= 1.10.0 required.
*
* @var boolean
Expand Down Expand Up @@ -173,6 +173,15 @@ class Mail_smtp extends Mail {
*/
var $debug = false;

/**
* we need the greeting; from it we can extract the authorative name of the mail
* server we've really connected to. ideal if we're connecting to a round-robin
* of relay servers and need to track which exact one took the email
*
* @var string
*/
var $greeting = null;

/**
* Indicates whether or not the SMTP connection should persist over
* multiple calls to the send() method.
Expand Down Expand Up @@ -413,7 +422,7 @@ public function getSMTPObject()
/* Attempt to authenticate if authentication has been enabled. */
if ($this->auth) {
$method = is_string($this->auth) ? $this->auth : '';

$tls = $this->starttls === false ? false : true;

if (PEAR::isError($res = $this->_smtp->auth($this->username,
Expand All @@ -426,7 +435,7 @@ public function getSMTPObject()
return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_AUTH);
}
}

/* Attempt to establish a TLS encrypted connection. PEAR/Net_SMTP >= 1.10.0 required. */
if ($this->starttls && !$this->auth) {
$starttls = $this->_smtp->starttls();
Expand Down

0 comments on commit 344577b

Please sign in to comment.