Skip to content

Commit 81cbbcf

Browse files
committed
proc_open() micro-optimization for Windows
1 parent b6b359b commit 81cbbcf

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ext/standard/proc_open.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ static zend_string *create_win_command_from_args(HashTable *args)
546546

547547
/* Get a boolean option from the `other_options` array which can be passed to `proc_open`.
548548
* (Currently, all options apply on Windows only.) */
549-
static bool get_option(zval *other_options, char *opt_name)
549+
static bool get_option(zval *other_options, char *opt_name, size_t opt_name_len)
550550
{
551551
HashTable *opt_ary = Z_ARRVAL_P(other_options);
552-
zval *item = zend_hash_str_find_deref(opt_ary, opt_name, strlen(opt_name));
552+
zval *item = zend_hash_str_find_deref(opt_ary, opt_name, opt_name_len);
553553
return item != NULL &&
554554
(Z_TYPE_P(item) == IS_TRUE ||
555555
((Z_TYPE_P(item) == IS_LONG) && Z_LVAL_P(item)));
@@ -1072,12 +1072,12 @@ PHP_FUNCTION(proc_open)
10721072

10731073
#ifdef PHP_WIN32
10741074
if (other_options) {
1075-
suppress_errors = get_option(other_options, "suppress_errors");
1075+
suppress_errors = get_option(other_options, "suppress_errors", strlen("suppress_errors"));
10761076
/* TODO: Deprecate in favor of array command? */
1077-
bypass_shell = bypass_shell || get_option(other_options, "bypass_shell");
1078-
blocking_pipes = get_option(other_options, "blocking_pipes");
1079-
create_process_group = get_option(other_options, "create_process_group");
1080-
create_new_console = get_option(other_options, "create_new_console");
1077+
bypass_shell = bypass_shell || get_option(other_options, "bypass_shell", strlen("bypass_shell"));
1078+
blocking_pipes = get_option(other_options, "blocking_pipes", strlen("blocking_pipes"));
1079+
create_process_group = get_option(other_options, "create_process_group", strlen("create_process_group"));
1080+
create_new_console = get_option(other_options, "create_new_console", strlen("create_new_console"));
10811081
}
10821082
#endif
10831083

0 commit comments

Comments
 (0)