bug #42079 [FrameworkBundle] Fixed file operations in Sodium vault seal (javiereguiluz)

This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Fixed file operations in Sodium vault seal

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

e31f8c52db [FrameworkBundle] Fixed file operations in Sodium vault seal
This commit is contained in:
Robin Chalas 2021-07-13 10:02:45 +02:00
commit a0496bd748
No known key found for this signature in database
GPG Key ID: 89672113756EE03B
1 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
$list = $this->list();
$list[$name] = null;
uksort($list, 'strnatcmp');
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list)), \LOCK_EX);
$this->lastMessage = sprintf('Secret "%s" encrypted in "%s"; you can commit it.', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
}
@ -142,7 +142,7 @@ class SodiumVault extends AbstractVault implements EnvVarLoaderInterface
$list = $this->list();
unset($list[$name]);
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list)), \LOCK_EX);
$this->lastMessage = sprintf('Secret "%s" removed from "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));