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

Skip to content

[PhpunitBridge] Read environment variable from superglobals #31954

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

Merged
merged 1 commit into from
Jun 26, 2019

Conversation

greg0ire
Copy link
Contributor

@greg0ire greg0ire commented Jun 8, 2019

Q A
Branch? 4.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #31857
License MIT
Doc PR n/a

The Dotenv component has recently been switched to using superglobals
instead of putenv(). Let us support both and give priority to
superglobals.

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch 2 times, most recently from 2a955f8 to afe721e Compare June 8, 2019 10:28
@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

@nicolas-grekas should I do something similar here:

if ('disabled' !== getenv('SYMFONY_DEPRECATIONS_HELPER')) {
DeprecationErrorHandler::register(getenv('SYMFONY_DEPRECATIONS_HELPER'));
}

?

@greg0ire greg0ire changed the title Read environment variable from superglobals [PhpunitBridge] Read environment variable from superglobals Jun 8, 2019
@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

Please resolve #31955 first

@nicolas-grekas
Copy link
Member

I'd propose merging this as a bug fix on 4.3, which is the very of Dotenv that relates here, WDYT?

@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

It can be viewed as a bug if you use the bridge v4.3 and a recent version of dotenv so yeah, let's do this :)

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch from afe721e to 0e832ca Compare June 8, 2019 14:26
@greg0ire greg0ire changed the base branch from 4.4 to 4.3 June 8, 2019 14:26
@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch from 0e832ca to e9971b5 Compare June 8, 2019 14:37
@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

Done. What about my question about the bootstrap file above?

@nicolas-grekas
Copy link
Member

Let's update the bootstrap file too.

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch from e9971b5 to 936cb7d Compare June 8, 2019 15:13
@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

I should really test before I push 😓

@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

Apparently having the class not defined at all is a requirement in disabled mode, so let's do this.

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch 2 times, most recently from e7e3593 to 72cb77a Compare June 8, 2019 15:26
@greg0ire
Copy link
Contributor Author

greg0ire commented Jun 8, 2019

Is setting via putenv kind of deprecated now? Or will it be fully supported forever? Should I change existing phpt files to randomly use each of them?

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch from 72cb77a to 1fe6eb2 Compare June 9, 2019 19:56
@greg0ire greg0ire marked this pull request as ready for review June 10, 2019 07:58
@nicolas-grekas nicolas-grekas added this to the 4.3 milestone Jun 11, 2019
@tgalopin
Copy link
Contributor

IMHO, this is quite important to finish and release as if I understand correctly, for now there is no way to configure the SYMFONY_DEPRECATIONS_HELPER variable except by using a real env var (quite cumbersome and the documentation is very misleading on this subject if that's true). Or am I missing something?

I'd be happy to give a hand to finish this if needed.

@greg0ire
Copy link
Contributor Author

Thanks for proposing your help @tgalopin . To me, this could very well be finished already, the only doubts I have are sum up in my previous comment. @nicolas-grekas what do you think the next steps are regarding this?

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch from 1fe6eb2 to 8dea1ee Compare June 23, 2019 15:20
@greg0ire
Copy link
Contributor Author

I do not reproduce the build failure locally (I use php 7.3). They are probably due to autoloading conflicts, as usual.

@greg0ire greg0ire force-pushed the read-env-var-from-superglobals branch from 8dea1ee to 1bbfbc4 Compare June 23, 2019 15:50
@fabpot
Copy link
Member

fabpot commented Jun 26, 2019

Can you have a look at the broken tests?

@nicolas-grekas nicolas-grekas force-pushed the read-env-var-from-superglobals branch 2 times, most recently from be0ecf5 to 3945785 Compare June 26, 2019 09:16
The Dotenv component has recently been switched to using superglobals
instead of putenv(). Let us support both and give priority to
superglobals.

Closes symfony#31857
@nicolas-grekas nicolas-grekas force-pushed the read-env-var-from-superglobals branch from 3945785 to 88cfcb5 Compare June 26, 2019 09:18
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

I reverted the changes on bootstrap.php: Dotenv always runs after the file is executed so that they were not needed. I also simplified the code: false already does what we planned for null to do.
Tests will pass once this is merged up to master.

@nicolas-grekas
Copy link
Member

Thank you @greg0ire.

@nicolas-grekas nicolas-grekas merged commit 88cfcb5 into symfony:4.3 Jun 26, 2019
nicolas-grekas added a commit that referenced this pull request Jun 26, 2019
…s (greg0ire)

This PR was merged into the 4.3 branch.

Discussion
----------

[PhpunitBridge] Read environment variable from superglobals

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #31857
| License       | MIT
| Doc PR        | n/a

The Dotenv component has recently been switched to using superglobals
instead of putenv(). Let us support both and give priority to
superglobals.

Commits
-------

88cfcb5 [PhpunitBridge] Read environment variable from superglobals
@greg0ire greg0ire deleted the read-env-var-from-superglobals branch June 26, 2019 09:43
@fabpot fabpot mentioned this pull request Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants