Skip to content
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

Changing params loader to use $_SERVER global instead of $_ENV #4401

merged 1 commit into from Aug 9, 2017


Copy link

@EricTendian EricTendian commented Jul 13, 2017

This PR changes the params loader to use the $_SERVER global when loading from a .env file instead of $_ENV. The global $_ENV is not populated by default on most installations of PHP, so users who try to use Codeception without any changes to their php.ini will not have params expanded into the corresponding values. I previously asked about this in the PR which refactored the ParamsLoader to this state but didn't get a response, so decided to make a PR and fix some issues I've been having.

There is not much difference between $_ENV and $_SERVER in a CLI context, and $_SERVER is already being returned by loadEnvironmentVars(), so this just makes it consistent.

Copy link

@DavertMik DavertMik commented Jul 31, 2017

Ok, looks good to me.

@DavertMik DavertMik merged commit 3635f74 into Codeception:2.3 Aug 9, 2017
4 checks passed
4 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
semaphoreci The build passed on Semaphore.
wercker/build Wercker pipeline passed
Copy link

@Micaso Micaso commented Feb 24, 2020

In using $_SERVER it is not possible anymore to use the same .env file in multiple subdirectories as decribed in the docs under
If I load the .env in the root codeception.yml file and in an codeception.yml file any of the included directories, then the params are not available in the codeception.yml file.
It could be bypassed if we use ->overload() instead of ->load().
I know the commit is nearly 3 years ago and maybe that time there were not an "include" options

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

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.