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

[FrameworkBundle] Replace var_export with VarExporter to use array short syntax in secrets list files #41795

Merged
merged 1 commit into from
Jun 22, 2021

Conversation

alexandre-daubois
Copy link
Contributor

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

I've been using secrets a lot lately. Unfortunately, command exports the {env}.list.php with the "old" array syntax using array(), and writing null in uppercase.

This results in tedious situations with PHP CS Fixer (for example) rewriting the whole file to restore the modern syntax, each time we add a secret.

The Sodium vault currently uses var_export. I suggest using Symfony VarExporter, which does the work just fine. It adds a dependency to the FrameworkBundle, but it is a cleaner way to do it rather than using this type of hack IMO.

@@ -27,7 +27,8 @@
"symfony/polyfill-mbstring": "~1.0",
"symfony/filesystem": "^3.4|^4.0|^5.0",
"symfony/finder": "^3.4|^4.0|^5.0",
"symfony/routing": "^4.4.12|^5.1.4"
"symfony/routing": "^4.4.12|^5.1.4",
"symfony/var-exporter": "^4.4|^5.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be removed actually: var-exporter is already a transitive dep via symfony/cache and that won't change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed, thanks for the info!

@derrabus
Copy link
Member

Thank you @alexandre-daubois.

@derrabus derrabus merged commit 124ecf0 into symfony:4.4 Jun 22, 2021
@alexandre-daubois alexandre-daubois deleted the fix-vault-list-format branch June 23, 2021 04:36
This was referenced Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants