From: tom at scl dot co dot uk
Operating system: Linux 2.4.18
PHP version: 4.3.3
PHP Bug Type: Mail related
Bug description: 'to' parmeter of mail() gets altered when containing trailing
whitespace
Description:
------------
When you hand a variable to the 'to' parameter of the mail() function
which has trailing whitespace the PHP variable get altered!
It seems the mail() function is stripping the trailing whitespace by
putting a null character at the start of it, but this is somehow getting
back into the PHP variable (as if it had been passed by reference?) so the
PHP variable contains a null character where the trailing whitespace
started before the mail() function was called.
Reproduce code:
---------------
<?php
// to address with trailing space
$to = '[EMAIL PROTECTED] ';
// Output the ASCII code for the last char
// in the $to address string
print("Last char=".ord($to{strlen($to)-1})."\n");
// Send a message to the email address in $to
mail($to, "Subject", "Message");
// Output the ASCII code for the last char
// in the $to address string
print("Last char=".ord($to{strlen($to)-1})."\n");
?>
Expected result:
----------------
Last char=32
Last char=32
Actual result:
--------------
Last char=32
Last char=0
--
Edit bug report at http://bugs.php.net/?id=25923&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25923&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25923&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25923&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25923&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25923&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25923&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25923&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25923&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25923&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25923&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25923&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25923&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25923&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25923&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25923&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25923&r=float