From b80923b370a11ce07ed7c2192a3e282cc0db229b Mon Sep 17 00:00:00 2001 From: Jorg Sowa Date: Wed, 14 Oct 2026 23:09:48 +0200 Subject: [PATCH] Fix proc_open() null descriptor not inheritable on Windows The nul handle was opened without security attributes, making it non-inheritable. It was then passed to CreateProcess() via STARTF_USESTDHANDLES, where the child cannot use a non-inheritable handle. Use php_proc_open_security so the handle is inheritable, like the pipe handles. --- ext/standard/proc_open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index 54a523a42919..ed01405e840e 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -845,7 +845,7 @@ static zend_result set_proc_descriptor_to_blackhole(descriptorspec_item *desc) { #ifdef PHP_WIN32 desc->childend = CreateFileA("nul", GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); + FILE_SHARE_READ | FILE_SHARE_WRITE, &php_proc_open_security, OPEN_EXISTING, 0, NULL); if (desc->childend == INVALID_HANDLE_VALUE) { php_error_docref(NULL, E_WARNING, "Failed to open nul"); return FAILURE;