Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rdarcy1
Copy link
Contributor

@rdarcy1 rdarcy1 commented Apr 30, 2021

Closes #776

Brings the compiled container in line with the non-compiled environment variable resolver (#757). Uses thread-safe $_ENV and $_SERVER in preference to getenv.

I couldn't see any tests relating specifically to this part but happy to add one if needed.

@mnapoli mnapoli added the bug label May 1, 2021
@mnapoli
Copy link
Member

mnapoli commented May 1, 2021

Thank you!

@mnapoli mnapoli merged commit da8e476 into PHP-DI:master May 1, 2021
@shadowhand
Copy link
Contributor

Is it safe to use $_SERVER this way, given that it can be modified by HTTP request?

@rdarcy1
Copy link
Contributor Author

rdarcy1 commented May 3, 2021

I believe the $_ENV superglobal can be modified in the same way? I don't have strong feelings about it, but both Laravel (vlucas/phpdotenv) and Symfony (symfony/dotenv) allow the use of $_SERVER so it's pretty well-established.

@rdarcy1 rdarcy1 deleted the compiled-env-vars branch May 4, 2021 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CompiledContainer does not look in $_ENV and $_SERVER for env variables

3 participants