From: Mark A. Hershberger Date: Thu, 7 Jul 2011 19:11:25 +0000 (+0000) Subject: Fixes Bug#17866 X-Git-Tag: 1.31.0-rc.0~29004 X-Git-Url: https://git.cyclocoop.org//%22?a=commitdiff_plain;h=56836511f420f435a29b92a1d291536d020f8f32;p=lhc%2Fweb%2Fwiklou.git Fixes Bug#17866 Minimal check that we have more than an empty string before sending and email. NikeRabbit asked me about LQT sending email to users w/o email addresses and this looked like one good place to add a check. --- diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0a7dc7f745..e2fd7e94bd 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -55,16 +55,18 @@ class MailAddress { # PHP's mail() implementation under Windows is somewhat shite, and # can't handle "Joe Bloggs " format email addresses, # so don't bother generating them - if ( $this->name != '' && !wfIsWindows() ) { - global $wgEnotifUseRealName; - $name = ( $wgEnotifUseRealName && $this->realName ) ? $this->realName : $this->name; - $quoted = UserMailer::quotedPrintable( $name ); - if ( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) { - $quoted = '"' . $quoted . '"'; + if ( $this->address ) { + if ( $this->name != '' && !wfIsWindows() ) { + global $wgEnotifUseRealName; + $name = ( $wgEnotifUseRealName && $this->realName ) ? $this->realName : $this->name; + $quoted = UserMailer::quotedPrintable( $name ); + if ( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) { + $quoted = '"' . $quoted . '"'; + } + return "$quoted <{$this->address}>"; + } else { + return $this->address; } - return "$quoted <{$this->address}>"; - } else { - return $this->address; } }