Mwalker has submitted this change and it was merged.

Change subject: array_walk is sad about array cast.  It breaks 
pass-by-reference.
......................................................................


array_walk is sad about array cast.  It breaks pass-by-reference.

Change-Id: Iac68ec47c398a6c2b82115fa45b2204c74a408f5
---
M SmashPig/Core/MailHandler.php
1 file changed, 12 insertions(+), 5 deletions(-)

Approvals:
  Mwalker: Verified; Looks good to me, approved



diff --git a/SmashPig/Core/MailHandler.php b/SmashPig/Core/MailHandler.php
index 97829c6..634f53e 100644
--- a/SmashPig/Core/MailHandler.php
+++ b/SmashPig/Core/MailHandler.php
@@ -6,6 +6,7 @@
  * Abstraction on top of whatever email client we're actually using. For the 
moment that's
  * PHPMailer on top of sendmail. The PHPMailer library must be in the include 
path. Use the
  * configuration node 'include-paths' to do this.
+ * FIXME: should be more explicit, phpmailer-include-path or something
  */
 class MailHandler {
 
@@ -67,11 +68,16 @@
                $mailer = static::mailbaseFactory();
 
                try {
-                       array_walk( (array)$to, function ( $value, $key ) use ( 
$mailer ) { $mailer->AddAddress( $value ); } );
-                       array_walk( (array)$cc, function ( $value, $key ) use ( 
$mailer ) { $mailer->AddCC( $value ); } );
-                       array_walk( (array)$bcc, function ( $value, $key ) use 
( $mailer ) { $mailer->AddBCC( $value ); } );
+                       $to = (array)$to;
+                       $cc = (array)$cc;
+                       $bcc = (array)$bcc;
+                       $archives = (array)$config->val( 
'email/archive-addresses' );
+
+                       array_walk( $to, function ( $value, $key ) use ( 
$mailer ) { $mailer->AddAddress( $value ); } );
+                       array_walk( $cc, function ( $value, $key ) use ( 
$mailer ) { $mailer->AddCC( $value ); } );
+                       array_walk( $bcc, function ( $value, $key ) use ( 
$mailer ) { $mailer->AddBCC( $value ); } );
                        array_walk(
-                               (array)$config->val( 'email/archive-addresses' 
),
+                               $archives,
                                function ( $value, $key ) use ( $mailer ) { 
$mailer->AddBCC( $value ); }
                        );
 
@@ -118,7 +124,8 @@
                        $mailer->Send();
 
                } catch (\phpmailerException $ex) {
-                       Logger::warning( "Could not send email to {$to}. PHP 
Mailer had exception.", null, $ex );
+                       $toStr = implode( ", ", $to );
+                       Logger::warning( "Could not send email to {$toStr}. PHP 
Mailer had exception.", null, $ex );
                        return false;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/61493
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iac68ec47c398a6c2b82115fa45b2204c74a408f5
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/fundraising/PaymentsListeners
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to