From 038e53420b35fe675153aacf43a5f7cefaec911c Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+ndossche@users.noreply.github.com> Date: Fri, 5 Dec 2025 18:51:42 +0100 Subject: [PATCH] standard: Fix error check for proc_open() command zval_get_string() can never return NULL, you need to use the try version to get NULL. This is observable because the process will still spawn even if an exception had occurred. To fix this, use the try variant. Closes GH-20650. --- NEWS | 3 +++ ext/standard/proc_open.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index be1c55a7c8e..007faa02495 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,9 @@ PHP NEWS - LDAP: . Fix memory leak in ldap_set_options(). (ndossche) +- Standard: + . Fix error check for proc_open() command. (ndossche) + 18 Dec 2025, PHP 8.3.29 - Core: diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index ce771098277..96e5a4ced99 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -510,7 +510,7 @@ typedef struct _descriptorspec_item { } descriptorspec_item; static zend_string *get_valid_arg_string(zval *zv, int elem_num) { - zend_string *str = zval_get_string(zv); + zend_string *str = zval_try_get_string(zv); if (!str) { return NULL; }