Skip to content

Fix testEnvCanBeReferenced for dotenv deferred resolution#1084

Open
GromNaN wants to merge 1 commit intosymfony:2.xfrom
GromNaN:fix-dump-env-test-deferred-dotenv-resolution
Open

Fix testEnvCanBeReferenced for dotenv deferred resolution#1084
GromNaN wants to merge 1 commit intosymfony:2.xfrom
GromNaN:fix-dump-env-test-deferred-dotenv-resolution

Conversation

@GromNaN
Copy link
Copy Markdown
Member

@GromNaN GromNaN commented Apr 2, 2026

symfony/dotenv >= 6.4.35/7.4.7/8.0.7 introduced deferred variable resolution (symfony/symfony#63496): variables like BAR=$FOO are now resolved after all .env files are loaded, using $_ENV['FOO'] (set by populate() from .env) rather than the system env at dump time.

This caused testEnvCanBeReferenced to fail: BAR now resolves to '123' (from .env) instead of 'Foo' (from $_SERVER via the runtime PHP expression).

The test is updated to use InstalledVersions::satisfies() to assert the correct expected value depending on the installed dotenv version, keeping compatibility with both old and new behavior.

@GromNaN GromNaN changed the title [DumpEnvCommand] Fix testEnvCanBeReferenced for dotenv deferred resolution Fix testEnvCanBeReferenced for dotenv deferred resolution Apr 2, 2026
…ution

symfony/dotenv >= 6.4.35/7.4.7/8.0.7 defers variable resolution so BAR=$FOO
now resolves using the .env value of FOO rather than the system env at dump time.
@GromNaN GromNaN force-pushed the fix-dump-env-test-deferred-dotenv-resolution branch from 3e8a659 to 2d94786 Compare April 2, 2026 22:42
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

Successfully merging this pull request may close these issues.

1 participant