Bug #70145 [NEW]: From field incorrectly parsed from headers
| From: | mberchtold at gmail dot com | Date: | Mon, 27 Jul 2015 00:43:17 +0000 |
| Subject: | Bug #70145 [NEW]: From field incorrectly parsed from headers | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-194730@lists.php.net to get a copy of this message | ||
From: mberchtold at gmail dot com
Operating system: Windows
PHP version: 7.0.0beta2
Package: Mail related
Bug Type: Bug
Bug description:From field incorrectly parsed from headers
Description:
------------
the mail function incorrectly parses the From field from the headers.
For example the when passing the following headers:
$headers = "DKIM-Signature: v=1; a=rsa-sha1;
bh=ZOokPFyLIFHFdZq7e/+JaJ+LVDI=; c=relaxed; d=test.com;
h=from:to:subject; s=mail;
Date: Mon, 27 Jul 2015 00:24:55 +0000
From: =?UTF-8?Q?test?= <sales@test.com>
To: mb@test.com";
the mail function fails and logs the following warning:
PHP Warning: mail(): "sendmail_from" not set in php.ini or
custom "From:" header missing in test.php on line 1
The problem seems to be that the mail implementation is confused by the
extra from in the first header:
h=from:to:subject; s=mail;
Test script:
---------------
// reproduces the bug
mail("mb@test.com", "subject", "message1", "DKIM-Signature: v=1;
a=rsa-sha1; bh=ZOokPFyLIFHFdZq7e/+JaJ+LVDI=; c=relaxed; d=test.com;
h=from:to:subject; s=mail;
Date: Mon, 27 Jul 2015 00:24:55 +0000
From: =?UTF-8?Q?test?= <sales@test.com>
To: mb@test.com");
// does not reproduce the bug
mail("mb@test.com", "subject", "message1", "DKIM-Signature: v=1;
a=rsa-sha1; bh=ZOokPFyLIFHFdZq7e/+JaJ+LVDI=; c=relaxed; d=test.com;
Date: Mon, 27 Jul 2015 00:24:55 +0000
From: =?UTF-8?Q?test?= <sales@test.com>
To: mb@test.com");
Expected result:
----------------
no warning
Actual result:
--------------
PHP Warning: mail(): "sendmail_from" not set in php.ini or
custom "From:" header missing in test.php on line 1
--
Edit bug report at https://bugs.php.net/bug.php?id=70145&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70145&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70145&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70145&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70145&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70145&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70145&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70145&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70145&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70145&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70145&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70145&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70145&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70145&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70145&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70145&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70145&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70145&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70145&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70145&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70145&r=mysqlcfg