Skip to content

Commit

Permalink
Fix: dynamic properties deprecation (pear#22)
Browse files Browse the repository at this point in the history
Initialized several undefined variables and properties
Fix bug giving port to constructor in smtpmx.php
  • Loading branch information
schengawegga committed Jul 11, 2023
1 parent 1215960 commit 4e3273a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Mail/RFC822.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ public function parseAddressList($address = null, $default_domain = null, $nest_
*/
protected function _splitAddresses($address)
{
$is_group = false;
$split_char = ',';

if (!empty($this->limit) && count($this->addresses) == $this->limit) {
return '';
}
Expand Down Expand Up @@ -442,6 +445,7 @@ protected function _hasUnclosedBracketsSub($string, &$num, $char)
*/
protected function _validateAddress($address)
{
$structure = null;
$is_group = false;
$addresses = array();

Expand Down Expand Up @@ -619,6 +623,7 @@ public function validateMailbox(&$mailbox)
$phrase = '';
$comment = '';
$comments = array();
$addr_spec = null;

// Catch any RFC822 comments and store them separately.
$_mailbox = $mailbox;
Expand Down Expand Up @@ -776,6 +781,7 @@ protected function _validateDomain($domain)
{
// Note the different use of $subdomains and $sub_domains
$subdomains = explode('.', $domain);
$sub_domains = array();

while (count($subdomains) > 0) {
$sub_domains[] = $this->_splitCheck($subdomains, '.');
Expand Down
13 changes: 13 additions & 0 deletions Mail/smtp.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@ class Mail_smtp extends Mail {
*/
var $socket_options = array();

/**
* If the message ends up in the queue, on the recipient server,
* the response will be saved here.
* Some successfully delivered emails will include a “queued”
* notation in the SMTP response, such as "250 OK; queued as 12345".
* This indicates that the email was delivered to the recipient
* as expected, but may require additional processing before it
* lands in the recipient’s inbox.
*
* @var string
*/
var $queued_as = null;

/**
* Constructor.
*
Expand Down
4 changes: 2 additions & 2 deletions Mail/smtpmx.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ function __construct($params)

// port number
if (isset($params['port'])) {
$this->_port = $params['port'];
$this->port = $params['port'];
} else {
$this->_port = getservbyname('smtp', 'tcp');
$this->port = getservbyname('smtp', 'tcp');
}

if (isset($params['timeout'])) $this->timeout = $params['timeout'];
Expand Down

0 comments on commit 4e3273a

Please sign in to comment.