Repository navigation
Conversation
Several 5.x changes need an entry in the update guide. Creating the file once keeps them from conflicting over its creation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loading StringHelper.php changed the process-wide default_charset setting, depending on whether some code had loaded the class yet. The side effect was deprecated in 4.x; UTF-8 has been PHP's default since 5.6. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary of Changes
When
StringHelper.phpis loaded, it runs@ini_set('default_charset', 'UTF-8')at file scope. That changes a process-wide PHP setting (the defaults ofhtmlspecialchars()/html_entity_decode()and theContent-Typecharset), depending on whether some code has loaded the class yet.UTF-8has been PHP's default since 5.6. This PR removes the side effect.Testing Instructions
New
Tests/DefaultCharsetTest.phpruns in a separate process: it setsdefault_charsettoISO-8859-1, autoloadsStringHelper, and asserts that the setting is unchanged. It fails before the change and passes after it.vendor/bin/phpunitis green, phpcs is clean, and PHPStan reports no errors locally. The PHPStan job in CI fails on4.x-dev/5.x-devas well, and #66 fixes that on 4.x.Documentation Changes Required
docs/v4-to-v5-update.md: a section "LoadingStringHelperno longer changesdefault_charset" that says what to do if an application relied on it.When 4.x-dev is merged up, the section that #82 adds to
docs/overview.md, and #72's "A note on loading this package", have to be removed on 5.x.Depends on #84 (this branch is built on it, so its commit shows up here until #84 is merged) and on #82, which deprecates the side effect in 4.x. #82 adds a
@deprecatedcomment above the removed line, which has to be resolved as a deletion when 4.x-dev is merged up. Related to #85, which also appends a section todocs/v4-to-v5-update.md, so expect a small conflict there.🤖 Generated with Claude Code