Skip to content

Commit 737cfd7

Browse files
[FrameworkBundle] Replace var_export with VarExporter to use array short syntax
1 parent 7472f7a commit 737cfd7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Secrets/SodiumVault.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Bundle\FrameworkBundle\Secrets;
1313

1414
use Symfony\Component\DependencyInjection\EnvVarLoaderInterface;
15+
use Symfony\Component\VarExporter\VarExporter;
1516

1617
/**
1718
* @author Tobias Schultze <http://tobion.de>
@@ -89,7 +90,7 @@ public function seal(string $name, string $value): void
8990
$list = $this->list();
9091
$list[$name] = null;
9192
uksort($list, 'strnatcmp');
92-
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", var_export($list, true), \LOCK_EX));
93+
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
9394

9495
$this->lastMessage = sprintf('Secret "%s" encrypted in "%s"; you can commit it.', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
9596
}
@@ -141,7 +142,7 @@ public function remove(string $name): bool
141142

142143
$list = $this->list();
143144
unset($list[$name]);
144-
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", var_export($list, true), \LOCK_EX));
145+
file_put_contents($this->pathPrefix.'list.php', sprintf("<?php\n\nreturn %s;\n", VarExporter::export($list), \LOCK_EX));
145146

146147
$this->lastMessage = sprintf('Secret "%s" removed from "%s".', $name, $this->getPrettyPath(\dirname($this->pathPrefix).\DIRECTORY_SEPARATOR));
147148

0 commit comments

Comments
 (0)