Repository navigation
Conversation
The docblock claimed that compliant() accepts five and six octet sequences and is less strict than valid(). PCRE's UTF-8 validation rejects them, as well as overlong forms, surrogates and incomplete sequences. 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
The docblock of
StringHelper::compliant()said that it "will pass five and six octet UTF-8 sequences", that it is less strict thanvalid(), and that using it on user input lets attackers inject 5- and 6-byte sequences. That is wrong.compliant()relies on PCRE's/uvalidation, which rejects five- and six-octet sequences, overlong forms, surrogates, code points above U+10FFFF and incomplete sequences. The docblock now says that. The code does not change.Testing Instructions
seedCompliantStrings, which feeds bothtestCompliantandtestValid, gets a five-octet ("\xF8\x88\x80\x80\x80") and a six-octet sequence. Both methods reject them, before and after this PR.vendor/bin/phpunitis green, phpcs is clean, and PHPStan reports no errors locally. The PHPStan job in CI fails on4.x-devas well (mb_trimand the other PHP 8.4 polyfill functions are not found), and #66 fixes that.Documentation Changes Required
None beyond the docblock. No docs page describes
compliant().Related to #75, which adds cases to the same data provider. They are on different lines, and a trial merge of the two branches is clean.
🤖 Generated with Claude Code