-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Closed
Copy link
Description
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):
symfony/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php
Lines 145 to 164 in b04512a
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
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
simonberger commentedon Jun 14, 2020
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 commentedon Jun 15, 2020
currently using php 7.3
picks44 commentedon Jun 16, 2020
I have the issue and using php 7.2
weaverryan commentedon Jun 18, 2020
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 theParameterCircularReferenceException
was also forSYMFONY_DECRYPTION_SECRET
in your case?simonberger commentedon Jun 18, 2020
This issue should be closed as a duplicate of #37142. Discussion and Information are splitting.
jderusse commentedon Jun 18, 2020
@weaverryan php 7.4 I guess
closing in favor of #37142