Improve UTF8 encoding process#641
Merged
kylekatarnls merged 2 commits intopdepend:masterfrom Jan 16, 2023
Merged
Conversation
Co-authored-by: Kyle <[email protected]>
kylekatarnls
approved these changes
Jan 16, 2023
Contributor
Author
|
Thank you very much for this fast approval! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: Deprecation warning removal
Issue: None (yet?)
Breaking change: no
Due to PHP 8.2 deprecating functions
utf8_encodeandutf8_decode, the utils methodUtf8Util::ensureEncodingcan create deprecation warnings when ran with PHP 8.2 without the "iconv" extension loaded.In this PR, I want to offer 2 new ways to ensure about the encoding in UTF-8 in case "iconv" is not enabled:
mb_convert_encoding(andmb_list_encodingsto prevent wrongly forced encodings) in case "iconv" wasn't usedutf8_encodein PHP 8.2 (and more recent versions) that is replaced by a polyfill Symfony is already providing since quite a long time.I did not added some unit tests to cover my case as I don't know how to simulate the non-existance of
iconvextension nor the existance ofmbstringextension, nor how to detect there are no more deprecated message in PHP 8.2. I just ran this modified version of pdepend on one of my project and I got the exact same values but without the deprecation messages.If someone can help me to provide unit tests if this is mandatory on this class, I would be really gladful to provide them.