-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Dotenv] Emebed commands inside .env
files makes the application crash
#38201
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
Comments
.env
files makes the application crash .env
files makes the application crash
.env
files makes the application crash .env
files makes the application crash
Is it a symfony/dotenv issue? No. mkdir /tmp/issue-38201 \
&& pushd /tmp/issue-38201 \
&& composer req symfony/dotenv:4.4.13 symfony/process:4.4.13 \
&& echo "SOME_ENV=\$(date +%s)" > .env \
&& php << 'DOTENV_TEST'
<?php
require 'vendor/autoload.php';
$dotenv = new \Symfony\Component\Dotenv\Dotenv();
$dotenv->loadEnv(__DIR__ . '/.env');
echo PHP_EOL, "\033[5;32m", $_ENV['SOME_ENV'], "\033[0m", PHP_EOL, PHP_EOL;
DOTENV_TEST
popd
rm -r /tmp/issue-38201 |
The problem happens when using symfony/flex's |
Faced the same issue. As this command is running through Composer it shares its dependencies. So that |
…s (Chi-teck) This PR was merged into the 4.4 branch. Discussion ---------- [Dotenv] Check if method inheritEnvironmentVariables exists | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #38201 | License | MIT | Doc PR | - Commits ------- bd72a56 Check if method inheritEnvironmentVariables exists
Symfony version(s) affected: 4.4.13
Description
When adding an embed command inside the
.env
and run thecomposer dump-env prod
, the application crashes:How to reproduce
You can use the reproducer here: tristanbes/process-reproducer#1
But you can test by just simply adding
SOURCE_VERSION=$(git rev-parse HEAD)
inside your.env
and runningcomposer dump-env prod
you end up with a fatal error.Additional context
Also tested and reproduced with Platform.sh
As stated in the documentation, it should be possible doing so
and it was working in previous version of Symfony
The text was updated successfully, but these errors were encountered: