Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Dotenv] Fix can not load BOM-signed env files#58216

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
hosni wants to merge1 commit intosymfony:6.4fromhosni:6.4
Closed

[Dotenv] Fix can not load BOM-signed env files#58216

hosni wants to merge1 commit intosymfony:6.4fromhosni:6.4

Conversation

@hosni
Copy link
Contributor

QA
Branch?6.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#58214
LicenseMIT

In this PR, I fixed the load env file BOM characters.
You can see the full explanation of the issue:#58214
More about BOM:Byte Order Mark

@hosni
Copy link
ContributorAuthor

hosni commentedSep 9, 2024
edited
Loading

Unit tests failed, but that's not my fault!
The reason is: (Testing /home/runner/work/symfony/symfony/src/Symfony/Bridge/Twig)
My unit tests working perfectly.


* 6.4.11 (2024-08-30)

* bug#58214[Dotenv] Fix can not load BOM-signed env files (hosni)
Copy link
Member

Choose a reason for hiding this comment

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

Please revert. This file is generated.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment
edited
Loading

Choose a reason for hiding this comment

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

dotenv files are modeled after sourced shell scripts.
I just tested and neither sh nor bash support parsing dotenv files that start with a BOM.
This means we should not do it.

Instead, we might consider throwing an exception when one is found.
I'd suggest doing it in the doLoad method.

Also, let's use str_starts_with to check for it.

OskarStark reacted with thumbs up emoji
@nicolas-grekas
Copy link
Member

Please submit a new PR if you want to provide the exception I suggested.

@xabbuh
Copy link
Member

see#58274 for the exception

nicolas-grekas added a commit that referenced this pull requestSep 16, 2024
…files with BOM (xabbuh)This PR was merged into the 5.4 branch.Discussion----------[Dotenv] throw a meaningful exception when parsing dotenv files with BOM| Q             | A| ------------- | ---| Branch?       | 5.4| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Issues        |Fix#58214| License       | MITThis replaces#58216. Other than in that PR I did not account for UTF-16 and UTF-32 byte-order-mark variants as that would IMO require us to first reliably detect the file encoding.Commits-------b4f3eaa throw a meaningful exception when parsing dotenv files with BOM
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas requested changes

@derrabusderrabusderrabus requested changes

Assignees

No one assigned

Projects

None yet

Milestone

6.4

Development

Successfully merging this pull request may close these issues.

5 participants

@hosni@nicolas-grekas@xabbuh@derrabus@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp