这不完全是一个错误,因为该功能仍然有效,但如果启用了E_ALL错误报告,并且我向邮件功能发送了多个电子邮件请求,我收到此通知,我不确定这是否值得解决与否。
Notice: Only variable references should be returned by reference in /usr/share/pear/Mail/mime.php
当我谷歌这个错误时,它报告是一个很久以前解决(或应该已经)的错误。我不确定这是否重要,但这也是发送电子邮件请求的功能:
public static function sendEMailSMTP($args = array()) {
if(self::_hasAdapter(get_class(), __FUNCTION__) )
return self::_callAdapter(get_class(), __FUNCTION__, $args);
$args += self::getEmailDefaults();
$args = self::_applyFilter( get_class(), __FUNCTION__ , $args , array('event'=>'args'));
if(is_array($args)){
extract($args);
$config=pv_getSiteEmailConfiguration();
if(empty($smtp_username)){
$smtp_username=$config['smtp_username'];
}
if(empty($smtp_password)){
$smtp_password=$config['smtp_password'];
}
if(empty($smtp_host)){
$smtp_host=$config['smtp_host'];
}
if(empty($smtp_port)){
$smtp_port=$config['smtp_port'];
}
require_once "Mail.php";
require_once 'Mail/mime.php';
$stmp_info= array (
'host' => $smtp_host,
'port' => $smtp_port,
'auth' => true,
'username' => $smtp_username,
'password' => $smtp_password
);
$headers = array (
'From' => $sender,
'To' => $receiver,
'Subject' => $subject
);
if(!empty($args['carboncopy'])){
$headers['Cc']=$args['carboncopy'];
$receiver.=','.$args['carboncopy'];
}
if(!empty($args['blindcopy'])){
$headers['Bcc']=$args['blindcopy'];
$receiver.=','.$args['blindcopy'];
}
if(!empty($args['reply_to'])){
$headers['Reply-To']=$args['reply_to'];
}
if(!empty($args['return_path'])){
$headers['Return-Path']=$args['return_path'];
}
if(!empty($args['errors_to'])){
$headers['Errors-To']=$args['errors_to'];
}
if(!empty($args['message_id'])){
$headers['Message-ID']=$args['message_id'];
}
if(empty($text_message)){
$text = strip_tags($message);
} else {
$text = $text_message;
}
if(empty($html_message)){
$html = $message;
} else {
$html= $html_message;
}
$mime = new Mail_mime("\n");
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
if(!empty($attachment)){
if(is_array($attachment)) {
foreach($attachment as $file) {
if(file_exists($file))
$mime->addAttachment($file , PVFileManager::getFileMimeType($file));
}//end foreach
} else {
$mime->addAttachment($attachment, PVFileManager::getFileMimeType($attachment));
}
}
$body = $mime->get();
$headers = $mime->headers($headers);
$smtp = Mail::factory('smtp', $stmp_info);
$mail = $smtp->send($receiver, $headers, $body);
self::_notify(get_class().'::'.__FUNCTION__, $args);
}
}//end sendEmailPHPSMTP
答案 0 :(得分:2)
这意味着Mail / Mime.php库是针对过时的php标准编码的,并且最有可能做类似的事情
$var =& new Obj();
在最近的PHP版本中,对象始终作为引用返回,因此指定引用分配会触发此警告。它没有害处,但应该修复。