Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[WebServerBundle] fix a bug where require would not require the good file because of env#25523
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
05888ce tocdd1c58Compare| $script =getenv('APP_FRONT_CONTROLLER') ?:'index.php'; | ||
| if (false ===getenv('APP_FRONT_CONTROLLER')) { | ||
| $script =$_ENV['APP_FRONT_CONTROLLER']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Not good, it should not squash the ternary above (when the env var doesn't exist, the value should remain 'index.php'). No need for calling getenv twice also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
changed
cdd1c58 tocd1dafaCompareSimperfit commentedDec 16, 2017
Status: Needs Review |
| thrownew \InvalidArgumentException(sprintf('Unable to find the front controller under "%s" (none of these files exist: %s).',$documentRoot,implode(',',$this->getFrontControllerFileNames($env)))); | ||
| } | ||
| putenv('APP_FRONT_CONTROLLER='.$file); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is it possible to just removeputenv here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think we should keep it because like@ostrolucky said there could be cases where $_ENV could be empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I also think we should remove the call to putenv (but alongside with -dvariable_order)
and then, symfony/process should be bumped to symfony/process^3.4.2 in the bundle's composer.json
ostrolucky commentedDec 16, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There should be some investigation regarding general usage of getenv/putenv/$_ENV/$_SERVER in Symfony code. I've seen people on slack too who complained that $_SERVER is not populated with Apache, but $_ENV is. I have tried it now with apache and neither $_SERVER nor $_ENV is populated, but getenv() is. When env is set via .htaccess, both $_SERVER and getenv is populated, but $_ENV isn't Then there are concurrency issues with getenv()/putenv() and now this PHP bug(?). Other than these bugs(?), there are also several other disadvantages for env variables. Old parameters.yml seems sweeter and sweeter to me as time goes on. |
Simperfit commentedDec 17, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Status: Needs Review |
| $script =getenv('APP_FRONT_CONTROLLER') ?:'index.php'; | ||
| $script =getenv('APP_FRONT_CONTROLLER'); | ||
| if (isset($_ENV['APP_FRONT_CONTROLLER']) &&false ===$script) { |
nicolas-grekasDec 18, 2017 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this doesn't work when "E" is not listed invariables_order, which is the default on Ubuntu
note that this file is used only withphp -S so we don't care behavior on Apache
I'd suggest to add-dvariables_order=EGPCS when callingphp -S, and then we can get rid of the call to getenv completely
chalasr commentedDec 18, 2017
Should it target 3.3? This code did not change in 3.4 AFAIK |
2bbab0f to4fdf6d8CompareSimperfit commentedDec 19, 2017
i'll rebase on 3.3, tell me if it's better to rebase on 3.4. The things is the bug appear only on 3.4 but hey, it could be on 3.3 too I guess. |
4fdf6d8 to7f69bf8Compare7f69bf8 to9352603Comparenicolas-grekas commentedDec 19, 2017
@Simperfit you forgot to account for this comment (just replace ^3.4.2 by ^3.3.14 since you rebased on 3.3):
|
9352603 to2a878a4Compare…file because of env
2a878a4 tobfeee1fCompareSimperfit commentedDec 20, 2017
done@nicolas-grekas |
nicolas-grekas commentedDec 20, 2017
@Simperfit not quite: ^3.3.14 != ~3.3.14 ;) |
nicolas-grekas commentedDec 20, 2017
Thank you@Simperfit. |
…e the good file because of env (Simperfit)This PR was merged into the 3.3 branch.Discussion----------[WebServerBundle] fix a bug where require would not require the good file because of env| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks? | no| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->| Tests pass? | yes| Fixed tickets |#25515| License | MIT| Doc PR |This fixes a bug with putenv that could be not working on certain version of php. (>=7.0.0).Commits-------bfeee1f [WebServerBundle] fix a bug where require would not require the good file because of env
| "symfony/console":"~3.3", | ||
| "symfony/http-kernel":"~3.3", | ||
| "symfony/process":"~3.3" | ||
| "symfony/process":"~3.3.14" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
this now forbids using 3.4, so not good. Should be~3.3.14 || ^3.4.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
was patched while merged, see743be09
Uh oh!
There was an error while loading.Please reload this page.
This fixes a bug with putenv that could be not working on certain version of php. (>=7.0.0).