Fix bug #75712: getenv in php-fpm should not read $_ENV, $_SERVER #13195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently
getenv()
returned array contains different environment variables compare to environment variable search by single varaible return call (passing string argument likegetenv($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.