Skip to content

sapi/apache2: apache env with walk_to_top going to the parent request. #14953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions sapi/apache2handler/php_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,7 @@ PHP_FUNCTION(apache_request_headers)
const apr_array_header_t *arr;
char *key, *val;

if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
ZEND_PARSE_PARAMETERS_NONE();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if the ZPP changes are committed in a separate commit than the rest.


array_init(return_value);

Expand All @@ -196,9 +194,7 @@ PHP_FUNCTION(apache_response_headers)
const apr_array_header_t *arr;
char *key, *val;

if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
ZEND_PARSE_PARAMETERS_NONE();

array_init(return_value);

Expand Down Expand Up @@ -243,13 +239,13 @@ PHP_FUNCTION(apache_note)

/* {{{ Set an Apache subprocess_env variable */
/*
* XXX this doesn't look right. shouldn't it be the parent ?*/
*/
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;
bool walk_to_top = false;
int arg_count = ZEND_NUM_ARGS();
request_rec *r;

Expand All @@ -262,8 +258,8 @@ PHP_FUNCTION(apache_setenv)
r = ctx->r;
if (arg_count == 3) {
if (walk_to_top) {
while(r->prev) {
r = r->prev;
if (r->main) {
r = r->main;
}
}
}
Expand All @@ -276,14 +272,13 @@ PHP_FUNCTION(apache_setenv)

/* {{{ Get an Apache subprocess_env variable */
/*
* XXX: shouldn't this be the parent not the 'prev'
*/
PHP_FUNCTION(apache_getenv)
{
php_struct *ctx;
char *variable;
size_t variable_len;
bool walk_to_top = 0;
bool walk_to_top = false;
int arg_count = ZEND_NUM_ARGS();
char *env_val=NULL;
request_rec *r;
Expand All @@ -297,8 +292,8 @@ PHP_FUNCTION(apache_getenv)
r = ctx->r;
if (arg_count == 2) {
if (walk_to_top) {
while(r->prev) {
r = r->prev;
if (r->main) {
r = r->main;
}
}
}
Expand Down
Loading