Edit report at https://bugs.php.net/bug.php?id=43327&edit=1
ID: 43327 Updated by: paj...@php.net Reported by: carsten_sttgt at gmx dot de Summary: wrong return value from mail(), if sendmail_path is wrong -Status: Open +Status: Assigned Type: Bug Package: Mail related Operating System: win32 only (?) PHP Version: 5.*, 6 (2009-08-07) -Assigned To: +Assigned To: pajoye Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2009-08-20 10:39:59] j...@php.net Reopened, fix was reverted. ------------------------------------------------------------------------ [2009-08-20 09:03:20] s...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revision&revision=287495 Log: - revert fix for #43327, it breaks system&co functions ------------------------------------------------------------------------ [2009-08-20 01:56:05] carsten_sttgt at gmx dot de 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 ------------------------------------------------------------------------ [2009-08-19 18:56:08] garre...@php.net Carsten, Can you retest with the latest 5.3 snapshot, and post feedback? Thanks ------------------------------------------------------------------------ [2009-08-19 18:43:46] s...@php.net 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 ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=43327 -- Edit this bug report at https://bugs.php.net/bug.php?id=43327&edit=1