Skip to content
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

[DependencyInjection] ParameterCircularReferenceException when creating secrets #37281

Closed
jderusse opened this issue Jun 14, 2020 · 6 comments
Closed

Comments

@jderusse
Copy link
Member

Symfony version(s) affected: 5.1

Description
When creating secrets with command, a ParameterCircularReferenceException is triggered.

How to reproduce

symfony new project --full
bin/console secret:set --env=prod TEST
bin/console secret:set --env=prod TEST2

Additional context

The EnvVarProcessor contains code to rpevend it, but I don't understand why it fails. Maybe related to the LazyString and exception triggered in __toString.
stack trace show that exception is triggered throught EnvVarProcessor line 153.
Line this line is wrap in try/catch block

#0 /data/oss/project/vendor/symfony/string/LazyString.php(41): 
...
#6 /data/oss/project/vendor/symfony/dependency-injection/EnvVarProcessor.php(153): 

try {
$i = 0;
$ended = true;
$count = $loaders instanceof \Countable ? $loaders->count() : 0;
foreach ($loaders as $loader) {
if (\count($this->loadedVars) > $i++) {
continue;
}
$this->loadedVars[] = $vars = $loader->loadEnvVars();
if (false !== $env = $vars[$name] ?? false) {
$ended = false;
break;
}
}
if ($ended || $count === $i) {
$loaders = $this->loaders;
}
} catch (ParameterCircularReferenceException $e) {
// skip loaders that need an env var that is not defined
} finally {

/cc @nicolas-grekas

@simonberger
Copy link
Contributor

I failed to reproduce this. Exception is thrown and caught.
I'm currently on a windows machine with PHP 7.4 in case this matters.

@jderusse
Copy link
Member Author

currently using php 7.3

@picks44
Copy link

picks44 commented Jun 16, 2020

I have the issue and using php 7.2

@weaverryan
Copy link
Member

I personally failed to reproduce this, but a user on SymfonyCasts definitely hit it - https://symfonycasts.com/screencast/symfony5-upgrade/secrets-vault-setup#comment-4957289406

So I'd say that there IS a legit issue here. The circular reference in that case was for SYMFONY_DECRYPTION_SECRET which the user never defined anywhere. I assume @jderusse that the ParameterCircularReferenceException was also for SYMFONY_DECRYPTION_SECRET in your case?

@simonberger
Copy link
Contributor

This issue should be closed as a duplicate of #37142. Discussion and Information are splitting.

@jderusse
Copy link
Member Author

@weaverryan php 7.4 I guess

closing in favor of #37142

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

6 participants