Skip to content

Commit 038e534

Browse files
committed
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.
1 parent 4969ef1 commit 038e534

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ PHP NEWS
1616
- LDAP:
1717
. Fix memory leak in ldap_set_options(). (ndossche)
1818

19+
- Standard:
20+
. Fix error check for proc_open() command. (ndossche)
21+
1922
18 Dec 2025, PHP 8.3.29
2023

2124
- Core:

ext/standard/proc_open.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ typedef struct _descriptorspec_item {
510510
} descriptorspec_item;
511511

512512
static zend_string *get_valid_arg_string(zval *zv, int elem_num) {
513-
zend_string *str = zval_get_string(zv);
513+
zend_string *str = zval_try_get_string(zv);
514514
if (!str) {
515515
return NULL;
516516
}

0 commit comments

Comments
 (0)