From b01ad755d05a7c358018a9d1542320e0916fa1aa Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Mon, 30 Sep 2024 21:29:23 +0100 Subject: [PATCH] sapi/apache2handler/php_functions.c: No need to rely on argnum --- sapi/apache2handler/php_functions.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/sapi/apache2handler/php_functions.c b/sapi/apache2handler/php_functions.c index b0434f2e4322..84437f12ebe9 100644 --- a/sapi/apache2handler/php_functions.c +++ b/sapi/apache2handler/php_functions.c @@ -249,22 +249,19 @@ PHP_FUNCTION(apache_setenv) php_struct *ctx; char *variable=NULL, *string_val=NULL; size_t variable_len, string_val_len; - bool walk_to_top = 0; - int arg_count = ZEND_NUM_ARGS(); + bool walk_to_top = false; request_rec *r; - if (zend_parse_parameters(arg_count, "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|b", &variable, &variable_len, &string_val, &string_val_len, &walk_to_top) == FAILURE) { RETURN_THROWS(); } ctx = SG(server_context); r = ctx->r; - if (arg_count == 3) { - if (walk_to_top) { - while(r->prev) { - r = r->prev; - } + if (walk_to_top) { + while(r->prev) { + r = r->prev; } } @@ -284,22 +281,19 @@ PHP_FUNCTION(apache_getenv) char *variable; size_t variable_len; bool walk_to_top = 0; - int arg_count = ZEND_NUM_ARGS(); char *env_val=NULL; request_rec *r; - if (zend_parse_parameters(arg_count, "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b", &variable, &variable_len, &walk_to_top) == FAILURE) { RETURN_THROWS(); } ctx = SG(server_context); r = ctx->r; - if (arg_count == 2) { - if (walk_to_top) { - while(r->prev) { - r = r->prev; - } + if (walk_to_top) { + while(r->prev) { + r = r->prev; } }