Skip to content

.env file always overiding environment variables when used in params #6923

@GameBurrow

Description

@GameBurrow

I've stumbled upon a bug reported here:
#6473

If configure my codeception.yml like this

params:
    - .env # load params from .env file
    - env # load params from environment vars

and a value comes both from .env file and ENV variable then the .env value is always used (no matter in which order you load the params).

In the original ticket the issue was fixed in #6477 however only SymfonyDotenv section was changed, could it be that the bug is still in if using PhpDotenv?

if (
class_exists(PhpDotenv::class) &&
class_exists(RepositoryBuilder::class) &&
method_exists(RepositoryBuilder::class, 'createWithDefaultAdapters')
) {
$repository = RepositoryBuilder::createWithDefaultAdapters()->make();
$dotenv = PhpDotenv::create($repository, codecept_root_dir(), codecept_relative_path($file));
return $dotenv->load();
}

Using verions 5.2.2 at the moment:

> php vendor/bin/codecept --version
Codeception 5.2.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions