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

kernel.environmentconfig: mistmatch between documentation and implementation #215

Open
tucksaun opened this issue Sep 3, 2024 · 3 comments

Comments

@tucksaun
Copy link

tucksaun commented Sep 3, 2024

The current documentation states:

It allows you to force using a given environment. If it is not set, it uses APP_ENV environment variable if defined or falls back to test.

However, the current code does not implement this:

private function setupTestEnvironment(string $fallback): void
{
// If there's no defined server / environment variable with an environment, default to configured fallback
if (($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) === null) {
putenv('APP_ENV=' . $_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $fallback);
}
}

The actual behavior of the code is to setup only if APP_ENV is not already defined (so not to force it) and the configuration value fallbacks to test (see

$this->setupTestEnvironment($config['kernel']['environment'] ?? 'test');
).

I'm willing to submit a PR to fix this issue but wanted to know which way the maintainers want to move: fix the documentation that is misleading or fix the behavior in order to match the documentation?

@walva
Copy link
Contributor

walva commented Nov 6, 2024

Hello @tucksaun,

I feel a bit guilty… I wrote this part of the documentation.

I lost a couple of hours because I wasn't aware of this option, so I wanted to inform. I cannot say which option is the best, but willing to help if I can.

@tucksaun
Copy link
Author

tucksaun commented Nov 7, 2024

Hey @walva 👋

Please don't: TBH intuitively a colleague and I though this would be the behaviour 🙂
Thank you for the help proposition, will keep in mind. But we need some guidance to know which way to go.
As you are a contributor, do you know someone we can ping maybe?

@walva
Copy link
Contributor

walva commented Nov 17, 2024

I’m sorry this was my only contribution even if I’m a big user of this extension. I would definitely one of the top contributors like @pamil or @Yozhef.

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

No branches or pull requests

2 participants