X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fmail%2FMailAddress.php;h=000bbe316bba5d5e1fa108feaf5207ddce230cff;hp=1686bbb0480b14b48f3d610c82b4947493251c72;hb=1dee28cb5f1efd6d9e14d6cc1d0c73c3f69269b4;hpb=d0a8e6b9b30272ec216a8a2ceda3b7fc60db1e7a diff --git a/includes/mail/MailAddress.php b/includes/mail/MailAddress.php index 1686bbb048..000bbe316b 100644 --- a/includes/mail/MailAddress.php +++ b/includes/mail/MailAddress.php @@ -46,22 +46,14 @@ class MailAddress { public $address; /** - * @param string $address String with an email address, or a User object - * @param string $name Human-readable name if a string address is given - * @param string $realName Human-readable real name if a string address is given + * @param string $address String with an email address + * @param string|null $name Human-readable name if a string address is given + * @param string|null $realName Human-readable real name if a string address is given */ function __construct( $address, $name = null, $realName = null ) { - if ( is_object( $address ) && $address instanceof User ) { - // Old calling format, now deprecated - wfDeprecated( __METHOD__ . ' with a User object', '1.24' ); - $this->address = $address->getEmail(); - $this->name = $address->getName(); - $this->realName = $address->getRealName(); - } else { - $this->address = strval( $address ); - $this->name = strval( $name ); - $this->realName = strval( $realName ); - } + $this->address = strval( $address ); + $this->name = strval( $name ); + $this->realName = strval( $realName ); } /** @@ -88,8 +80,9 @@ class MailAddress { global $wgEnotifUseRealName; $name = ( $wgEnotifUseRealName && $this->realName !== '' ) ? $this->realName : $this->name; $quoted = UserMailer::quotedPrintable( $name ); - if ( strpos( $quoted, '.' ) !== false || strpos( $quoted, ',' ) !== false ) { - $quoted = '"' . $quoted . '"'; + // Must only be quoted if string does not use =? encoding (T191931) + if ( $quoted === $name ) { + $quoted = '"' . addslashes( $quoted ) . '"'; } return "$quoted <{$this->address}>"; } else {