Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Conversation

@Simperfit
Copy link
Contributor

@SimperfitSimperfit commentedDec 16, 2017
edited
Loading

QA
Branch?3.4
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#25515
LicenseMIT
Doc PR

This fixes a bug with putenv that could be not working on certain version of php. (>=7.0.0).

Seikyo reacted with thumbs up emoji
@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch from05888ce tocdd1c58CompareDecember 16, 2017 17:02
$script =getenv('APP_FRONT_CONTROLLER') ?:'index.php';

if (false ===getenv('APP_FRONT_CONTROLLER')) {
$script =$_ENV['APP_FRONT_CONTROLLER'];
Copy link
Member

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

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

changed

@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch fromcdd1c58 tocd1dafaCompareDecember 16, 2017 18:03
@Simperfit
Copy link
ContributorAuthor

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);
Copy link
Member

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?

chalasr reacted with thumbs up emoji
Copy link
ContributorAuthor

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

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
Copy link
Contributor

ostrolucky commentedDec 16, 2017
edited
Loading

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.

apfelbox reacted with thumbs up emoji

@Simperfit
Copy link
ContributorAuthor

Simperfit commentedDec 17, 2017
edited
Loading

Status: Needs Review

$script =getenv('APP_FRONT_CONTROLLER') ?:'index.php';
$script =getenv('APP_FRONT_CONTROLLER');

if (isset($_ENV['APP_FRONT_CONTROLLER']) &&false ===$script) {
Copy link
Member

@nicolas-grekasnicolas-grekasDec 18, 2017
edited
Loading

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

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneDec 18, 2017
@chalasr
Copy link
Member

Should it target 3.3? This code did not change in 3.4 AFAIK

@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch 2 times, most recently from2bbab0f to4fdf6d8CompareDecember 19, 2017 07:29
@Simperfit
Copy link
ContributorAuthor

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.

@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch from4fdf6d8 to7f69bf8CompareDecember 19, 2017 07:36
@SimperfitSimperfit changed the base branch from3.4 to3.3December 19, 2017 07:37
@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch from7f69bf8 to9352603CompareDecember 19, 2017 07:37
@nicolas-grekas
Copy link
Member

@Simperfit you forgot to account for this comment (just replace ^3.4.2 by ^3.3.14 since you rebased on 3.3):

symfony/process should be bumped to symfony/process ^3.4.2 in the bundle's composer.json

@nicolas-grekasnicolas-grekas modified the milestones:3.4,3.3Dec 19, 2017
@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch from9352603 to2a878a4CompareDecember 19, 2017 13:08
@SimperfitSimperfitforce-pushed thebugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branch from2a878a4 tobfeee1fCompareDecember 19, 2017 13:09
@Simperfit
Copy link
ContributorAuthor

done@nicolas-grekas

@nicolas-grekas
Copy link
Member

@Simperfit not quite: ^3.3.14 != ~3.3.14 ;)

chalasr reacted with thumbs up emojiSimperfit reacted with laugh emoji

@nicolas-grekas
Copy link
Member

Thank you@Simperfit.

@nicolas-grekasnicolas-grekas merged commitbfeee1f intosymfony:3.3Dec 20, 2017
nicolas-grekas added a commit that referenced this pull requestDec 20, 2017
…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
@SimperfitSimperfit deleted the bugfix/fix-a-bug-with-web-server-bundle-where-putenv-is-not-working branchDecember 20, 2017 14:42
"symfony/console":"~3.3",
"symfony/http-kernel":"~3.3",
"symfony/process":"~3.3"
"symfony/process":"~3.3.14"
Copy link
Member

@stofstofDec 20, 2017
edited
Loading

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

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

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@stofstofstof left review comments

@fabpotfabpotfabpot requested changes

@chalasrchalasrchalasr approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

3.3

Development

Successfully merging this pull request may close these issues.

7 participants

@Simperfit@ostrolucky@chalasr@nicolas-grekas@fabpot@stof@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp