Skip to content

Commit f365510

Browse files
committed
ext/standard: Reuse computed strlen() value in getopt()
1 parent a718110 commit f365510

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/standard/basic_functions.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,13 +1084,13 @@ PHP_FUNCTION(getopt)
10841084
}
10851085
} else {
10861086
/* other strings */
1087-
if ((args = zend_hash_str_find(Z_ARRVAL_P(return_value), optname, strlen(optname))) != NULL) {
1087+
if ((args = zend_hash_str_find(Z_ARRVAL_P(return_value), optname, optname_len)) != NULL) {
10881088
if (Z_TYPE_P(args) != IS_ARRAY) {
10891089
convert_to_array(args);
10901090
}
10911091
zend_hash_next_index_insert(Z_ARRVAL_P(args), &val);
10921092
} else {
1093-
zend_hash_str_add(Z_ARRVAL_P(return_value), optname, strlen(optname), &val);
1093+
zend_hash_str_add(Z_ARRVAL_P(return_value), optname, optname_len, &val);
10941094
}
10951095
}
10961096

0 commit comments

Comments
 (0)