X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmail%2FUserMailer.php;h=7b739027f819fcd5e8d70f0b26908d3092009e6d;hb=095c50ade11ccea3b0edc8956ad45dea46d4c18b;hp=47fa16f87fd0da278cfcaf47c611845423430128;hpb=02b5b7f9fb880570af51c12951577a0b540f25db;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/mail/UserMailer.php b/includes/mail/UserMailer.php index 47fa16f87f..7b739027f8 100644 --- a/includes/mail/UserMailer.php +++ b/includes/mail/UserMailer.php @@ -34,8 +34,8 @@ class UserMailer { * Send mail using a PEAR mailer * * @param Mail_smtp $mailer - * @param string $dest - * @param string $headers + * @param string[]|string $dest + * @param array $headers * @param string $body * * @return Status @@ -382,6 +382,8 @@ class UserMailer { throw new MWException( 'PEAR mail package is not installed' ); } + $recips = array_map( 'strval', $to ); + Wikimedia\suppressWarnings(); // Create the mail object using the Mail::factory method @@ -391,19 +393,20 @@ class UserMailer { Wikimedia\restoreWarnings(); return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() ); } + '@phan-var Mail_smtp $mail_object'; wfDebug( "Sending mail via PEAR::Mail\n" ); $headers['Subject'] = self::quotedPrintable( $subject ); // When sending only to one recipient, shows it its email using To: - if ( count( $to ) == 1 ) { - $headers['To'] = $to[0]->toString(); + if ( count( $recips ) == 1 ) { + $headers['To'] = $recips[0]; } // Split jobs since SMTP servers tends to limit the maximum // number of possible recipients. - $chunks = array_chunk( $to, $wgEnotifMaxRecips ); + $chunks = array_chunk( $recips, $wgEnotifMaxRecips ); foreach ( $chunks as $chunk ) { $status = self::sendWithPear( $mail_object, $chunk, $headers, $body ); // FIXME : some chunks might be sent while others are not!