Skip to content

Commit 0133827

Browse files
committed
Use HashTable directly instead of zval
1 parent ef6eeed commit 0133827

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ext/standard/proc_open.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,9 @@ static zend_string* get_command_from_array(HashTable *array, char ***argv, uint3
643643
return command;
644644
}
645645

646-
static descriptorspec_item* alloc_descriptor_array(zval *descriptorspec)
646+
static descriptorspec_item* alloc_descriptor_array(HashTable *descriptorspec)
647647
{
648-
uint32_t ndescriptors = zend_hash_num_elements(Z_ARRVAL_P(descriptorspec));
648+
uint32_t ndescriptors = zend_hash_num_elements(descriptorspec);
649649
return ecalloc(sizeof(descriptorspec_item), ndescriptors);
650650
}
651651

@@ -1002,7 +1002,8 @@ PHP_FUNCTION(proc_open)
10021002
{
10031003
zend_string *command_str;
10041004
HashTable *command_ht;
1005-
zval *descriptorspec, *pipes; /* Mandatory arguments */
1005+
HashTable *descriptorspec; /* Mandatory argument */
1006+
zval *pipes; /* Mandatory argument */
10061007
char *cwd = NULL; /* Optional argument */
10071008
size_t cwd_len = 0; /* Optional argument */
10081009
zval *environment = NULL, *other_options = NULL; /* Optional arguments */
@@ -1038,7 +1039,7 @@ PHP_FUNCTION(proc_open)
10381039

10391040
ZEND_PARSE_PARAMETERS_START(3, 6)
10401041
Z_PARAM_ARRAY_HT_OR_STR(command_ht, command_str)
1041-
Z_PARAM_ARRAY(descriptorspec)
1042+
Z_PARAM_ARRAY_HT(descriptorspec)
10421043
Z_PARAM_ZVAL(pipes)
10431044
Z_PARAM_OPTIONAL
10441045
Z_PARAM_STRING_OR_NULL(cwd, cwd_len)
@@ -1088,7 +1089,7 @@ PHP_FUNCTION(proc_open)
10881089
descriptors = alloc_descriptor_array(descriptorspec);
10891090

10901091
/* Walk the descriptor spec and set up files/pipes */
1091-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(descriptorspec), nindex, str_index, descitem) {
1092+
ZEND_HASH_FOREACH_KEY_VAL(descriptorspec, nindex, str_index, descitem) {
10921093
if (str_index) {
10931094
zend_argument_value_error(2, "must be an integer indexed array");
10941095
goto exit_fail;

0 commit comments

Comments
 (0)