Skip to content

Fix bug #75712: getenv in php-fpm should not read $_ENV, $_SERVER #13195

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

Closed
wants to merge 1 commit into from

Conversation

bukka
Copy link
Member

@bukka bukka commented Jan 19, 2024

Currently getenv() returned array contains different environment variables compare to environment variable search by single varaible return call (passing string argument like getenv($env_name)). The bigger problem is that the array does not even have to contain only string values. In case of the reported issue it copied argv array into it.

The reason for the above misbehaviour is that it uses logic used for $_ENV filling which does different thing in PHP-FPM (even though some of the logic is also questionable and should be changed) due to some historic reasons most likely. It also applies variable filtering which is not used for single value return.

The PR fixes the issue by introducing a different function for loading env vars which defaults to calling old import function. This is overwritten in FPM and different logic (matching single env return) is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant