Bug #73203 [NEW]: passing additional_parameters causes mail to fail
| From: | mberchtold at gmail dot com | Date: | Thu, 29 Sep 2016 20:46:09 +0000 |
| Subject: | Bug #73203 [NEW]: passing additional_parameters causes mail to fail | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204349@lists.php.net to get a copy of this message | ||
From: mberchtold at gmail dot com
Operating system: Windows
PHP version: 7.1.0RC3
Package: Mail related
Bug Type: Bug
Bug description:passing additional_parameters causes mail to fail
Description:
------------
Problem
=======
mail throws this fatal error if an additional_parameters (even if it is
an empty string) is passed to the function:
PHP Fatal error: mail(): Escaped command exceeds the allowed length of
8192 bytes
Cause
=====
In the mail function, the extra_cmd is escaped with
php_escape_shell_cmd:
https://github.com/php/php-src/blob/master/ext/standard/mail.c#L374
This is incorrect if the string is not passed to an executable. This is
the case on Windows when SMTP is used (php.ini: mail.SMTP).
Solution
========
The additional_parameters argument should be ignored (and therefore not
be escaped) if it is not used (not passed to a shell command).
Also there seems to be another bug where php_escape_shell_cmd fails if
an empty string is passed.
Test script:
---------------
mail("test@test.com", "subject", "message", "From:
lala@test.com", "");
Actual result:
--------------
PHP Fatal error: mail(): Escaped command exceeds the allowed length of
8192 bytes
--
Edit bug report at https://bugs.php.net/bug.php?id=73203&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73203&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73203&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73203&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73203&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73203&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73203&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73203&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73203&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73203&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73203&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73203&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73203&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73203&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73203&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73203&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73203&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73203&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73203&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73203&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73203&r=mysqlcfg