pajoye          Tue Jun  9 14:07:06 2009 UTC

  Modified files:              
    /php-src/ext/standard       proc_open.c 
    /php-src/ext/standard/tests/file    bug41874.phpt bug41874_1.phpt 
                                        bug41874_2.phpt bug41874_3.phpt 
  Log:
  - MFB: #41874, separate STDOUT and STDERR in exec functions
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.68&r2=1.69&diff_format=u
Index: php-src/ext/standard/proc_open.c
diff -u php-src/ext/standard/proc_open.c:1.68 
php-src/ext/standard/proc_open.c:1.69
--- php-src/ext/standard/proc_open.c:1.68       Thu Mar 26 20:02:29 2009
+++ php-src/ext/standard/proc_open.c    Tue Jun  9 14:07:06 2009
@@ -15,7 +15,7 @@
    | Author: Wez Furlong <w...@thebrainroom.com>                           |
    +----------------------------------------------------------------------+
  */
-/* $Id: proc_open.c,v 1.68 2009/03/26 20:02:29 felipe Exp $ */
+/* $Id: proc_open.c,v 1.69 2009/06/09 14:07:06 pajoye Exp $ */
 
 #if 0 && (defined(__linux__) || defined(sun) || defined(__IRIX__))
 # define _BSD_SOURCE           /* linux wants this when XOPEN mode is on */
@@ -444,6 +444,7 @@
        STARTUPINFO si;
        BOOL newprocok;
        SECURITY_ATTRIBUTES security;
+       DWORD dwCreateFlags = 0;
        char *command_with_cmd;
        UINT old_error_mode;
 #endif
@@ -742,13 +743,18 @@
                old_error_mode = 
SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX);
        }
        
+       dwCreateFlags = NORMAL_PRIORITY_CLASS;
+       if(strcmp(sapi_module.name, "cli") != 0) {
+               dwCreateFlags |= CREATE_NO_WINDOW;
+       }
+
        if (bypass_shell) {
-               newprocok = CreateProcess(NULL, command, &security, &security, 
TRUE, NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env.envp, cwd, &si, &pi);
+               newprocok = CreateProcess(NULL, command, &security, &security, 
TRUE, dwCreateFlags, env.envp, cwd, &si, &pi);
        } else {
                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);
-
+               newprocok = CreateProcess(NULL, command_with_cmd, &security, 
&security, TRUE, dwCreateFlags, env.envp, cwd, &si, &pi);
+               
                efree(command_with_cmd);
        }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41874.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/file/bug41874.phpt
diff -u /dev/null php-src/ext/standard/tests/file/bug41874.phpt:1.2
--- /dev/null   Tue Jun  9 14:07:06 2009
+++ php-src/ext/standard/tests/file/bug41874.phpt       Tue Jun  9 14:07:06 2009
@@ -0,0 +1,22 @@
+--TEST--
+bug #41874 (Separate STDOUT and STDERR in exec functions)
+--CREDITS--
+Venkat Raman Don
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+       die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+$result = exec('cd 1:\\non_existant; dir nonexistant');
+echo "$result";
+system('cd 1:\\non_existant; dir nonexistant');
+$result = shell_exec('cd 1:\\non_existant; dir nonexistant');
+echo $result;
+?>
+--EXPECT--
+The system cannot find the drive specified.
+The system cannot find the drive specified.
+The system cannot find the drive specified.
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41874_1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/file/bug41874_1.phpt
diff -u /dev/null php-src/ext/standard/tests/file/bug41874_1.phpt:1.2
--- /dev/null   Tue Jun  9 14:07:06 2009
+++ php-src/ext/standard/tests/file/bug41874_1.phpt     Tue Jun  9 14:07:06 2009
@@ -0,0 +1,16 @@
+--TEST--
+bug #41874 (Separate STDOUT and STDERR in exec functions)
+--CREDITS--
+Venkat Raman Don
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+               die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+popen("1:\\non_existent", "r");
+?>
+--EXPECT--
+The system cannot find the drive specified.
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41874_2.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/file/bug41874_2.phpt
diff -u /dev/null php-src/ext/standard/tests/file/bug41874_2.phpt:1.2
--- /dev/null   Tue Jun  9 14:07:06 2009
+++ php-src/ext/standard/tests/file/bug41874_2.phpt     Tue Jun  9 14:07:06 2009
@@ -0,0 +1,17 @@
+--TEST--
+bug #41874 (Separate STDOUT and STDERR in exec functions)
+--CREDITS--
+Venkat Raman Don
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+               die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+$result = exec('cd 1:\\non_existant; dir nonexistant');
+echo "$result";
+?>
+--EXPECT--
+The system cannot find the drive specified.
\ No newline at end of file
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41874_3.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/standard/tests/file/bug41874_3.phpt
diff -u /dev/null php-src/ext/standard/tests/file/bug41874_3.phpt:1.2
--- /dev/null   Tue Jun  9 14:07:06 2009
+++ php-src/ext/standard/tests/file/bug41874_3.phpt     Tue Jun  9 14:07:06 2009
@@ -0,0 +1,16 @@
+--TEST--
+bug #41874 (Separate STDOUT and STDERR in exec functions)
+--CREDITS--
+Venkat Raman Don
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+               die('skip windows only test');
+}
+?>
+--FILE--
+<?php
+system('cd 1:\\non_existant; dir nonexistant');
+?>
+--EXPECT--
+The system cannot find the drive specified.
\ No newline at end of file



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to