fixed lib to work with php8.3

This commit is contained in:
Ulf Gebhardt 2024-11-19 23:50:45 +01:00
parent 627134c651
commit 4a84300839
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
5 changed files with 11 additions and 14 deletions

View File

@ -153,7 +153,7 @@ class Mail
foreach ($headers as $key => $value) {
$headers[$key] =
preg_replace('=((<CR>|<LF>|0x0A/%0A|0x0D/%0D|\\n|\\r)\S).*=i',
null, $value);
'', $value);
}
}

View File

@ -178,6 +178,8 @@ class Mail_smtp extends Mail {
*/
var $socket_options = array();
var $queued_as = null;
var $greeting = null;
/**
* Constructor.
*
@ -305,7 +307,7 @@ class Mail_smtp extends Mail {
$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);

View File

@ -899,7 +899,7 @@ class Mail_mime
$attachments = count($this->parts) > 0;
$html_images = count($this->html_images) > 0;
$html = strlen($this->htmlbody) > 0;
$calendar = strlen($this->calbody) > 0;
$calendar = strlen($this->calbody ?? '') > 0;
$has_text = strlen($this->txtbody) > 0;
$text = !$html && $has_text;
$mixed_params = array('preamble' => $this->build_params['preamble']);
@ -1372,7 +1372,7 @@ class Mail_mime
$attachments = count($this->parts) > 0;
$html_images = count($this->html_images) > 0;
$html = strlen($this->htmlbody) > 0;
$calendar = strlen($this->calbody) > 0;
$calendar = strlen($this->calbody ?? '') > 0;
$has_text = strlen($this->txtbody) > 0;
$text = !$html && $has_text;
$headers = array();

View File

@ -1,7 +1,4 @@
<?php
// error_reporting returns the old error code
$old_error_reporting = error_reporting(0);
/**
* PEAR, the PHP Extension and Application Repository
*
@ -222,7 +219,7 @@ class PEAR
);
}
return call_user_func_array(
array(get_class(), '_' . $method),
array(static::class, '_' . $method),
array_merge(array($this), $arguments)
);
}
@ -235,7 +232,7 @@ class PEAR
);
}
return call_user_func_array(
array(get_class(), '_' . $method),
array(static::class, '_' . $method),
array_merge(array(null), $arguments)
);
}
@ -840,6 +837,7 @@ class PEAR_Error
var $message = '';
var $userinfo = '';
var $backtrace = null;
var $callback = null;
/**
* PEAR_Error constructor
@ -1113,7 +1111,4 @@ class PEAR_Error
* tab-width: 4
* c-basic-offset: 4
* End:
*/
// reset error_reporting to its old value
error_reporting($old_error_reporting);
*/

View File

@ -169,7 +169,7 @@ class mailcannon {
{
return sprintf(
"<%s.%s@%s>",
base_convert(microtime(), 10, 36),
base_convert(preg_replace( '/[^0-9]/', '', microtime()), 10, 36),
base_convert(bin2hex(openssl_random_pseudo_bytes(8)), 16, 36),
$domain
);