ID: 43327
User updated by: carsten_sttgt at gmx dot de
Reported By: carsten_sttgt at gmx dot de
Status: Closed
Bug Type: Mail related
Operating System: win32 only (?)
PHP Version: 5.*, 6 (2009-08-07)
Assigned To: garretts
New Comment:
Hi Garrett,
> Can you retest with the latest 5.3 snapshot, and post feedback?
I can do this. Just some remarks first:
> This occurs because popen_ex executes the command using the comspec
> ('cmd.exe'), which will always create a valid process--but intended
> actual child process fails.
That's correct. No error during creation of the process ("cmd.exe" /
"GetLastError == 0"). But in this case, "cmd.exe" returns an exit code
!= 0, which is available with "GetExitCodeProcess()". So you know
there's a problem.
Regarding mail():
- mail() does not detect that "cmd.exe" can't start "sendmail.exe"
- it also does not detect, if "cmd.exe" can start "sendmail.exe",
but "sendmail.exe" is returning an exit code != 0
--> if "cmd.exe" can start a program, it's returning the exit
code from that program, and so this is available with
GetExitCodeProcess().
So there is the question, why does mail() does not test the return
value of pclose() in a correct way on windows? At the moment it looks
like:
| #ifdef PHP_WIN32
| if (ret == -1)
| {
| MAIL_RET(0);
| } else {
| MAIL_RET(1);
| }
But I think it should be also something like?:
| if (ret != 0)
> I'm patching this so that it skips using cmd.exe--there is really
> no reason this should be here,
Some hints:
- If you want start an executable with just the name and without the
extension (like ".com, *.pl"), you must do this through "cmd.exe"
(only for "*.exe" files you can use just the name).
- In the MSDN you can read, that you have to use "cmd.exe" to start
a batchfile with CreateProcess. Ok, for me that's working without
"cmd.exe". But maybe this depends on the Windows version or
compiler.
Regards,
Carsten
Previous Comments:
------------------------------------------------------------------------
[2009-08-19 18:56:08] [email protected]
Carsten,
Can you retest with the latest 5.3 snapshot, and post feedback?
Thanks
------------------------------------------------------------------------
[2009-08-19 18:43:46] [email protected]
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=287480
Log: - fixed #43327, wrong return value from mail(), if sendmail_path
is wrong
------------------------------------------------------------------------
[2009-08-19 16:15:49] [email protected]
or, it will be once I get some karma in /TSRM ...
------------------------------------------------------------------------
[2009-08-19 16:10:43] [email protected]
This occurs because popen_ex executes the command using the comspec
('cmd.exe'), which will always create a valid process--but intended
actual child process fails.
I'm patching this so that it skips using cmd.exe--there is really no
reason this should be here, if this introduces other problems (which I
can't see what they could possibly be), then those should be fixed
appropriately.
Patched in all branches (5.2.11-dev, 5.3.1-dev and trunk)
------------------------------------------------------------------------
[2009-07-20 10:08:36] carsten_sttgt at gmx dot de
After some delay...
If've just test this with PHP 5.3.0 and mail() still returns TRUE, even
if PHP can't find the sendmail binary or the sendmail binary returns an
errorlevel != 0.
Regards,
Carsten)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/43327
--
Edit this bug report at http://bugs.php.net/?id=43327&edit=1