8000 DI - problem with resolve env after update from 3.3 to 4.0.1 · Issue #25477 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
DI - problem with resolve env after update from 3.3 to 4.0.1 #25477
Closed
@alexpts

Description

@alexpts
Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 4.0.1
Dump/cache container no

After update from 3.3 to 4.0.1 env values from sub array not resolve to real value on compile container with $resolveEnvPlaceholders=true.

Example yml config:

parameters:
    static.domain: '%env(STATIC_DOMAIN)%'
    array.static:
        domain: '%env(STATIC_DOMAIN)%'
        sub:
          domain: '%env(STATIC_DOMAIN)%'

services:
    demo.env:
      class: Project\ProjectDemoEnv
      arguments: ['%static.domain%', '%array.static%']
      public: true

Class:

<?php
declare(strict_types=1);

namespace Project;

class ProjectDemoEnv
{
    public function __construct(string $cdn, array $config)
    {
        echo 'inline:' . $cdn . "\n";
        echo 'fromArray::' . $config['domain'] . "\n";
        echo 'fromSubArray::' . $config['sub']['domain'] . "\n";
    }
}

inline://static.domain.ru/
fromArray:://static.domain.ru/ fromSubArray::env_STATIC_DOMAIN_190b296f9508e8ebee983c41c97121da - bug

If we try get value from parameter it is work:

echo $container->getParameter('array.static')['sub']['domain']; //  //static.domain.ru/ 

It work correct in 3.3.
Version 3.4 i skip, need check it all version from 3.3.

Note: I can reproduce problem only runtime container without dump/cache container.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0