nette/database

Wrong configuration detection when using environment variables

Kocicak opened this issue · 0 comments

Version: v3.0.0 v3.0.0-alpha v3.0.0-RC1 v2.4.8 v2.4.7 v2.4.6 v2.4.5 v2.4.4 v2.4.3 v2.4.2 v2.4.1 v2.4.0

Bug Description

When using PhpLiteral for all database configuration directives, all of them are skipped and service is not initialized.

Steps To Reproduce

bootstrap.php:

$configurator->addDynamicParameters([
    'env' => getenv()
]);

database.neon config:

database:
    dsn: %env.MYSQL_DSN%
    user: %env.MYSQL_USER%
    password: %env.MYSQL_PASSWORD%

Expected Behavior

Database gets initialized and service registered

Possible Solution

reverting comit cadc1a6#diff-2fcee4c8b8de0b3276a0db928f59d69e fixes this. Problem is that not a single configuration value is scalar. maybe change that is_scalar() condition? Add || $v instanceof PhpLiteral ?