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
8000

DI - problem with resolve env after update from 3.3 to 4.0.1 #25477

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

Closed
alexpts opened this issue Dec 13, 2017 · 13 comments
Closed

DI - problem with resolve env after update from 3.3 to 4.0.1 #25477

alexpts opened this issue Dec 13, 2017 · 13 comments

Comments

@alexpts
Copy link
alexpts commented Dec 13, 2017
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.

@linaori
Copy link
Contributor
linaori commented Dec 14, 2017

Version 3.4 i skip

You should first upgrade to 3.4, fix all deprecations and then go to 4.0. Does it work in 3.4? Do you have deprecations in 3.4 that might tell you how to solve this?

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

I did not check 3.4.
I checked it only 4.0.1.

@alexpts alexpts closed this as completed Dec 14, 2017
@alexpts alexpts reopened this Dec 14, 2017
@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

Can you check it yourself?

@linaori
Copy link
Contributor
linaori commented Dec 14, 2017

You can check it, I can't. If you want to upgrade to 4.0, you first have to do 3.4, that's how it goes. If you skip 3.4, there's not much the community can do to check if this is an issue in Symfony without a lot of knowledge of the code in question.

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

I dont understand how it relation.

Suppose I updated to 3.4 and did not notice this problem. Then I updated to 4 and found the problem, but I still did not exactly reproduce it on 3.4.

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

If the described example is not enough. I can prepare clean repo with problem without other code for reproduce it.

@sroze
Copy link
Contributor
sroze commented Dec 14, 2017

If the described example is not enough. I can prepare clean repo with problem without other code for reproduce it.

That would be much better 👍

But still try 3.4. The point is to try to identify deprecations on 3.4. If you see deprecations, it means your code use things that are not working anymore in 4.0 (and might fail silently - tho shouldn't). If it's the case then you'll be directly pointed out to the things you need to change and you might just have to fix them to have your application working with Symfony 4.

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

Ok, I will prepare clean repo for reproduce.
I will add link here to repo.

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

Clean repo for reproduce this bug - https://github.com/alexpts/bug-symfony-di
It reproduce in 3.4 and 4.0.

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

Problem was fix in commit - c2266bb

I think we need wait new fix version. Am I right?

@sroze
Copy link
Contributor
sroze commented Dec 14, 2017

You are correct, this was merged 3 days ago

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

was fixed in #25245

@alexpts
Copy link
Author
alexpts commented Dec 14, 2017

Ok, Thanks! Will wait new fix version

@alexpts alexpts closed this as completed Dec 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
0