ID: 25361 Updated by: [EMAIL PROTECTED] Reported By: sam at freepeers dot com Status: Feedback Bug Type: Program Execution Operating System: Windows 2000 PHP Version: 4.3.2 New Comment:
Non volatile link (Sorry Pierre) : http://rquadling.php1h.com/proc_open.c.diff2 Previous Comments: ------------------------------------------------------------------------ [2007-08-03 09:04:55] [EMAIL PROTECTED] Index: proc_open.c =================================================================== RCS file: /repository/php-src/ext/standard/proc_open.c,v retrieving revision 1.57 diff -u -r1.57 proc_open.c --- proc_open.c 28 May 2007 23:00:25 -0000 1.57 +++ proc_open.c 2 Aug 2007 09:30:57 -0000 @@ -740,7 +740,7 @@ if (bypass_shell) { newprocok = CreateProcess(NULL, command, &security, &security, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi); } else { - spprintf(&command_with_cmd, 0, "%s /c %s", GetVersion() < 0x80000000 ? COMSPEC_NT : COMSPEC_9X, command); + spprintf(&command_with_cmd, 0, "%s /c \"%s\"", GetVersion() < 0x80000000 ? COMSPEC_NT : COMSPEC_9X, command); newprocok = CreateProcess(NULL, command_with_cmd, &security, &security, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi); ------------------------------------------------------------------------ [2007-08-02 09:33:59] [EMAIL PROTECTED] It may be that the /S is not required. http://pastie.caboo.se/84306 ------------------------------------------------------------------------ [2007-08-02 09:28:08] [EMAIL PROTECTED] And thanks to Ashar Lohmar <[EMAIL PROTECTED]>, as he put me onto this fix. He had a similar issue with wscript. ------------------------------------------------------------------------ [2007-08-02 09:22:46] [EMAIL PROTECTED] For Windows NT+ (i.e. not win98-), this SEEMS to work. cmd /s /c ""your long command" "another file"" Compare this against ... cmd /c "your long command" "another file" which doesn't work. The /S option basically treats the rest of the string in quotes as a command line. This is slightly different behaviour. %COMPSPEC% /S /C ""C:\Program Files\Internet Explorer\IEXPLORE.EXE" "http://www.php.net"" This is a patch to proc_open.c which I think should deal with the issue. It may need to be optimized. Index: proc_open.c =================================================================== RCS file: /repository/php-src/ext/standard/proc_open.c,v retrieving revision 1.57 diff -u -r1.57 proc_open.c --- proc_open.c 28 May 2007 23:00:25 -0000 1.57 +++ proc_open.c 2 Aug 2007 09:21:02 -0000 @@ -740,7 +740,12 @@ if (bypass_shell) { newprocok = CreateProcess(NULL, command, &security, &security, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi); } else { - spprintf(&command_with_cmd, 0, "%s /c %s", GetVersion() < 0x80000000 ? COMSPEC_NT : COMSPEC_9X, command); + if (GetVersion() < 0x80000000) { + /* Wrap command in quotes and use the /s parameter to pass quotes to the command line. */ + spprintf(&command_with_cmd, 0, "%s /s /c \"%s\"", COMSPEC_NT, command); + } else { + spprintf(&command_with_cmd, 0, "%s /c %s", COMSPEC_9X, command); + } newprocok = CreateProcess(NULL, command_with_cmd, &security, &security, TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi); http://pastie.caboo.se/84303 ------------------------------------------------------------------------ [2003-09-02 18:08:10] [EMAIL PROTECTED] PHP uses "cmd.exe /c" for executing programs under windows. You can try your examples on command line: cmd.exe /c "your long command" "another file" And you'll see it does not work. This is not PHP problem but yet another windows problem. You must always use the '8.3' format of the paths/filenames. ------------------------------------------------------------------------ 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/25361 -- Edit this bug report at http://bugs.php.net/?id=25361&edit=1