summaryrefslogtreecommitdiff
path: root/ext/standard/proc_open.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/proc_open.c')
-rw-r--r--ext/standard/proc_open.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index 612cdf0f88..8347ea7864 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -447,7 +447,7 @@ PHP_FUNCTION(proc_open)
ZEND_PARSE_PARAMETERS_START(3, 6)
Z_PARAM_STRING(command, command_len)
Z_PARAM_ARRAY(descriptorspec)
- Z_PARAM_ZVAL_DEREF(pipes)
+ Z_PARAM_ZVAL(pipes)
Z_PARAM_OPTIONAL
Z_PARAM_STRING_EX(cwd, cwd_len, 1, 0)
Z_PARAM_ARRAY_EX(environment, 1, 0)
@@ -862,6 +862,11 @@ PHP_FUNCTION(proc_open)
#endif
/* we forked/spawned and this is the parent */
+ pipes = zend_try_array_init(pipes);
+ if (!pipes) {
+ goto exit_fail;
+ }
+
proc = (struct php_process_handle*)pemalloc(sizeof(struct php_process_handle), is_persistent);
proc->is_persistent = is_persistent;
proc->command = command;
@@ -873,9 +878,6 @@ PHP_FUNCTION(proc_open)
#endif
proc->env = env;
- zval_ptr_dtor(pipes);
- array_init(pipes);
-
#if PHP_CAN_DO_PTS
if (dev_ptmx >= 0) {
close(dev_ptmx);