[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
| From: | Ilia Alshanetsky | Date: | Sat, 19 Sep 2026 21:37:53 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141292@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-09-19T17:37:06-04:00
Commit: https://github.com/php/php-src/commit/6baec6288b30f27b0eec18816df689ec6dc69d7b
Raw diff: https://github.com/php/php-src/commit/6baec6288b30f27b0eec18816df689ec6dc69d7b.diff
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix three Win32-only defects in proc_open descriptor handling
Changed paths:
M NEWS
M ext/standard/proc_open.c
Diff:
diff --git a/NEWS b/NEWS
index 0a8f3f02eb48..592c19bb1a98 100644
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,11 @@ PHP NEWS
. Fixed a crash when SQLite3::close() is called from a userland callback.
(Ilia Alshanetsky)
+- Standard:
+ . Fixed three Windows-only proc_open() defects: an uninitialized
+ PROCESS_INFORMATION, an indeterminate comspec pointer after a failed
+ lookup, and an unchecked CreateFileA() failure. (Ilia Alshanetsky)
+
24 Sep 2026, PHP 8.5.11
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 01661351be8e..da03160c2771 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -691,7 +691,7 @@ static void init_startup_info(STARTUPINFOW *si, descriptorspec_item *descriptors
static void init_process_info(PROCESS_INFORMATION *pi)
{
- memset(&pi, 0, sizeof(pi));
+ memset(pi, 0, sizeof(*pi));
}
/* on success, returns length of *comspec, which then needs to be efree'd by caller */
@@ -742,7 +742,7 @@ static size_t find_comspec_nt(wchar_t **comspec)
static zend_result convert_command_to_use_shell(wchar_t **cmdw, size_t cmdw_len)
{
- wchar_t *comspec;
+ wchar_t *comspec = NULL;
size_t len = find_comspec_nt(&comspec);
if (len == 0) {
php_error_docref(NULL, E_WARNING, "Command conversion failed");
@@ -827,7 +827,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);
- if (desc->childend == NULL) {
+ if (desc->childend == INVALID_HANDLE_VALUE) {
php_error_docref(NULL, E_WARNING, "Failed to open nul");
return FAILURE;
}