]> granicus.if.org Git - php/commitdiff
- Fix #50524, proc_open should respect cwd as it does on other platforms
authorPierre Joye <pajoye@php.net>
Wed, 8 Sep 2010 08:34:57 +0000 (08:34 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 8 Sep 2010 08:34:57 +0000 (08:34 +0000)
ext/standard/proc_open.c

index 95740a1d91fafe329f4954c2179b129f2025d419..6f4d88e942d5ad6a33432c21388aa9c540f18143 100644 (file)
@@ -677,6 +677,16 @@ PHP_FUNCTION(proc_open)
        }
 
 #ifdef PHP_WIN32
+       if (cwd == NULL) {
+               char cur_cwd[MAXPATHLEN];
+               char *getcwd_result;
+               getcwd_result = VCWD_GETCWD(cur_cwd, MAXPATHLEN);
+               if (!getcwd_result) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot get current directory");
+                       goto exit_fail;
+               }
+       }
+
        memset(&si, 0, sizeof(si));
        si.cb = sizeof(si);
        si.dwFlags = STARTF_USESTDHANDLES;