Merge "config: Add new ConfigRepository"
[lhc/web/wiklou.git] / includes / mail / MailAddress.php
index 1686bbb..1b66c38 100644 (file)
@@ -47,8 +47,8 @@ class MailAddress {
 
        /**
         * @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|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 ) {
@@ -88,8 +88,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 {