From 56836511f420f435a29b92a1d291536d020f8f32 Mon Sep 17 00:00:00 2001 From: "Mark A. Hershberger" Date: Thu, 7 Jul 2011 19:11:25 +0000 Subject: [PATCH] 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. --- includes/UserMailer.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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; } } -- 2.20.1