Commit 038e53420b3 for php.net
commit 038e53420b35fe675153aacf43a5f7cefaec911c
Author: Niels Dossche <7771979+ndossche@users.noreply.github.com>
Date: Fri Dec 5 18:51:42 2025 +0100
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.
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;
}