Skip to content

Commit cbc4910

Browse files
committed
Use HashTable directly instead of zval
1 parent 1145256 commit cbc4910

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, int n
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-
int 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

@@ -998,7 +998,8 @@ PHP_FUNCTION(proc_open)
998998
{
999999
zend_string *command_str;
10001000
HashTable *command_ht;
1001-
zval *descriptorspec, *pipes; /* Mandatory arguments */
1001+
HashTable *descriptorspec; /* Mandatory argument */
1002+
zval *pipes; /* Mandatory argument */
10021003
char *cwd = NULL; /* Optional argument */
10031004
size_t cwd_len = 0; /* Optional argument */
10041005
zval *environment = NULL, *other_options = NULL; /* Optional arguments */
@@ -1034,7 +1035,7 @@ PHP_FUNCTION(proc_open)
10341035

10351036
ZEND_PARSE_PARAMETERS_START(3, 6)
10361037
Z_PARAM_ARRAY_HT_OR_STR(command_ht, command_str)
1037-
Z_PARAM_ARRAY(descriptorspec)
1038+
Z_PARAM_ARRAY_HT(descriptorspec)
10381039
Z_PARAM_ZVAL(pipes)
10391040
Z_PARAM_OPTIONAL
10401041
Z_PARAM_STRING_OR_NULL(cwd, cwd_len)
@@ -1084,7 +1085,7 @@ PHP_FUNCTION(proc_open)
10841085
descriptors = alloc_descriptor_array(descriptorspec);
10851086

10861087
/* Walk the descriptor spec and set up files/pipes */
1087-
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL_P(descriptorspec), nindex, str_index, descitem) {
1088+
ZEND_HASH_FOREACH_KEY_VAL(descriptorspec, nindex, str_index, descitem) {
10881089
if (str_index) {
10891090
zend_argument_value_error(2, "must be an integer indexed array");
10901091
goto exit_fail;

0 commit comments

Comments
 (0)