UserMailer: Use PHP_EOL instead of DIY
authorChad Horohoe <chadh@wikimedia.org>
Wed, 11 Nov 2015 01:28:32 +0000 (17:28 -0800)
committerChad Horohoe <chadh@wikimedia.org>
Wed, 11 Nov 2015 01:28:32 +0000 (17:28 -0800)
Also fixes arrayToHeaderString() to be correct when called without
the $endl parameter

Change-Id: I8b9f72500f9a055f9f2e1cfcbb276d565674f1b8

includes/mail/UserMailer.php

index 49ce21c..85595f1 100644 (file)
@@ -64,7 +64,7 @@ class UserMailer {
         *
         * @return string
         */
         *
         * @return string
         */
-       static function arrayToHeaderString( $headers, $endl = "\n" ) {
+       static function arrayToHeaderString( $headers, $endl = PHP_EOL ) {
                $strings = array();
                foreach ( $headers as $name => $value ) {
                        // Prevent header injection by stripping newlines from value
                $strings = array();
                foreach ( $headers as $name => $value ) {
                        // Prevent header injection by stripping newlines from value
@@ -292,11 +292,7 @@ class UserMailer {
 
                // Line endings need to be different on Unix and Windows due to
                // the bug described at http://trac.wordpress.org/ticket/2603
 
                // Line endings need to be different on Unix and Windows due to
                // the bug described at http://trac.wordpress.org/ticket/2603
-               if ( wfIsWindows() ) {
-                       $endl = "\r\n";
-               } else {
-                       $endl = "\n";
-               }
+               $endl = PHP_EOL;
 
                if ( is_array( $body ) ) {
                        // we are sending a multipart message
 
                if ( is_array( $body ) ) {
                        // we are sending a multipart message