8000 bug #35099 [FrameworkBundle] Do not throw exception on value generate… · symfony/symfony@84de1a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 84de1a3

Browse files
bug #35099 [FrameworkBundle] Do not throw exception on value generate key (jderusse)
This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle] Do not throw exception on value generate key | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | N/A | License | MIT | Doc PR | N/A When using env variable instead of key files and creating a new Secret, the check in `generateKeys` (called by the command `SecretsSetCommand`) prevents generating a secret. reproducer: ``` $ rm config/secrets/prod/prod.decrypt.private.php $ export SYMFONY_DECRYPTION_SECRET=XXX $ ./bin/console secret:set FOO In SodiumVault.php line 50: Cannot generate keys when a decryption key has been provided while instantiating the vault. ``` This PR converts the exception in a warning message. Commits ------- 2f608b4 Do not throw exception on valut generate key
2 parents 415761e + 2f608b4 commit 84de1a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Secrets/SodiumVault.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public function generateKeys(bool $override = false): bool
4747
$this->lastMessage = null;
4848

4949
if (null === $this->encryptionKey && '' !== $this->decryptionKey = (string) $this->decryptionKey) {
50-
throw new \LogicException('Cannot generate keys when a decryption key has been provided while instantiating the vault.');
50+
$this->lastMessage = 'Cannot generate keys when a decryption key has been provided while instantiating the vault.';
51+
52+
return false;
5153
}
5254

5355
try {

0 commit comments

Comments
 (0)
0