Skip to content

Commit 0ba3a6f

Browse files
committed
Convert command field of process handle to zend_string
1 parent 0133827 commit 0ba3a6f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ext/standard/proc_open.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static void proc_open_rsrc_dtor(zend_resource *rsrc)
288288

289289
_php_free_envp(proc->env);
290290
efree(proc->pipes);
291-
efree(proc->command);
291+
zend_string_release_ex(proc->command, false);
292292
efree(proc);
293293
}
294294
/* }}} */
@@ -374,7 +374,7 @@ PHP_FUNCTION(proc_get_status)
374374
}
375375

376376
array_init(return_value);
377-
add_assoc_string(return_value, "command", proc->command);
377+
add_assoc_str(return_value, "command", zend_string_copy(proc->command));
378378
add_assoc_long(return_value, "pid", (zend_long)proc->child);
379379

380380
#ifdef PHP_WIN32
@@ -1237,7 +1237,7 @@ PHP_FUNCTION(proc_open)
12371237
}
12381238

12391239
proc = (php_process_handle*) emalloc(sizeof(php_process_handle));
1240-
proc->command = estrdup(ZSTR_VAL(command_str));
1240+
proc->command = zend_string_copy(command_str);
12411241
proc->pipes = emalloc(sizeof(zend_resource *) * ndesc);
12421242
proc->npipes = ndesc;
12431243
proc->child = child;

ext/standard/proc_open.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ typedef struct _php_process_handle {
4141
#endif
4242
size_t npipes;
4343
zend_resource **pipes;
44-
char *command;
44+
zend_string *command;
4545
php_process_env env;
4646
} php_process_handle;

0 commit comments

Comments
 (0)