mirror of
https://github.com/php/php-src.git
synced 2024-11-23 09:54:15 +08:00
sapi/apache2handler/php_functions.c: No need to rely on argnum (#16143)
This commit is contained in:
parent
acf1a6cfa0
commit
98a4c53ad5
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user