Page MenuHomePhabricator

UserMailer.php function send() throws warning if $to is an array of MailAddress
Closed, ResolvedPublic

Description

function send() in includes/UserMailer.php has a first parameter, $to, that can be a singleton or an array. If a singleton, it must be a MailAddress object. If you pass an array of MailAddress objects, however, you get the warning:

Object of class MailAddress to string conversion in .../includes/UserMailer.php on line 115

The line is:

wfDebug( __METHOD__.': sending mail to ' . implode( ',', $to ) . "\n" );

This is strange. send() seems to be expecting an array of strings, or a single MailAddress, but not an array of MailAddress objects.

This is either a bug to be fixed, or extra documentation is needed about valid values for $to.


Version: 1.16.x
Severity: normal

Details

Reference
bz23648

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:11 PM
bzimport set Reference to bz23648.
bzimport added a subscriber: Unknown Object (MLST).

It's the wfDebug() that's wrong, it should accept arrays of objects not strings. Fixed the wfDebug() in r66871.