From: jjohnson at salesteamautomation dot com Operating system: Windows XP PHP version: 4.3.11 PHP Bug Type: Mail related Bug description: Problems with mail and str_replace
Description: ------------ We're having a problem with mail and str_replace. If we use str_replace on certain emails before sending them, we get extra characters in the email that is sent. Right before sending, the email looks fine. When it is received, however, it has extra characters. If str_replace is not used, the received email does not have extra characters. Reproduce code: --------------- $content_template = '<html><head></head><body><DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Web only - $1,100 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">*There is a one time set-up fee of $499 which we will waive with a three year agreement.</SPAN></FONT></body></html>'; $content = "· Web only - $1,100 per year ". "· Phone only - $1,300 per year ". "· Both - $1,500 per year ". "*There is a one time set-up fee of $499 which we will waive with a three year agreement. "; class EmailTest{ function EmailTest($email_from, $email_to, $subject, $content_template, $content){ $this->email_from = $email_from; $this->email_to = $email_to; $this->subject = $subject; $this->content = $content; $this->content_template = $content_template; } } $email =& new EmailTest( "[EMAIL PROTECTED]", "[EMAIL PROTECTED]", "SilentWhistle Follow-up", $content_template, $content); $email->content_template = str_replace("\n",'',$email->content_template); $email->content = str_replace('', '', $email->content_template); $email->content = $email->content_template; $header = "MIME-Version: 1.0\nContent-Type: text/html; charset=iso-8859-1\n"; $result = mail($email->email_to, $email->subject, $email->content, $header, ''); Expected result: ---------------- This is the expected email: · Web only - $1,100 per year · Phone only - $1,300 per year · Both - $1,500 per year *There is a one time set-up fee of $499 which we will waive with a three year agreement. This is the html from the expected email: <html><head></head><body><DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Web only - $1,100 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">*There is a one time set-up fee of $499 which we will waive with a three year agreement.</SPAN></FONT></body></html> Actual result: -------------- This is the received email: · Web only - $1,100 per year · ; Phone only - $1,300 per year · Both - $1,500 per year *There is a one time set-up fee of $499 which we will waive with a three year agreement. This is the html from the received email: <html><head></head><body><DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Web only - $1,100 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt ">  ; </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Phone only - $1,300 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="MARGIN-LEFT: 0.75in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo6; tab-stops: list .75in"><FONT face=Symbol size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"><SPAN style="mso-list: Ignore">·<FONT face="Times New Roman" size=1><SPAN style="FONT: 7pt "> </SPAN></FONT></SPAN></SPAN></FONT><SPAN dir=ltr><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Both - $1,500 per year<o:p></o:p></SPAN></FONT></SPAN> <DT class=MsoNormal style="TEXT-INDENT: 0.5in"><FONT face=Arial color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black; FO NT-FAMILY: Arial">*There is a one time set-up fee of $499 which we will waive with a three year agreement.</SPAN></FONT></body></html> -- Edit bug report at http://bugs.php.net/?id=33709&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33709&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33709&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33709&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=33709&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=33709&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=33709&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=33709&r=needscript Try newer version: http://bugs.php.net/fix.php?id=33709&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=33709&r=support Expected behavior: http://bugs.php.net/fix.php?id=33709&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=33709&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=33709&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=33709&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33709&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=33709&r=dst IIS Stability: http://bugs.php.net/fix.php?id=33709&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=33709&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=33709&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=33709&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=33709&r=mysqlcfg