From 266ff49a9ae5dbf5fcc8b912ad6bb1b92e4a42c0 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 8 Sep 2010 08:34:57 +0000 Subject: [PATCH] - Fix #50524, proc_open should respect cwd as it does on other platforms --- NEWS | 2 ++ ext/standard/proc_open.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/NEWS b/NEWS index 9461892ebe..f955586795 100644 --- a/NEWS +++ b/NEWS @@ -75,6 +75,8 @@ (a_jelly_doughnut at phpbb dot com, Pierre) - Fixed #50953, socket will not connect to IPv4 address when the host has both IPv4 and IPv6 addresses, on Windows. (Gustavo, Pierre) +- Fixed #50524, proc_open on Windows does not respect cwd as it does on other + platforms. (Pierre) 22 Jul 2010, PHP 5.3.3 - Upgraded bundled sqlite to version 3.6.23.1. (Ilia) diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 0b4f5e0f12..988ea75875 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -752,6 +752,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; -- 2.50.1