Repository navigation
Conversation
FlatText inherited Text::setRawMimeDirValue(), which splits values on unescaped commas, although its documentation says they are not delimiters. getValue() then returned the value escaped again (newlines as a literal \n), and jCard got several values for one. LineFoldingIssueTest gets back the escaped comma its data had before bedefa1, and expects the line folded since it is one octet longer. 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.
Property\FlatTextrepresents single-value text properties: NOTE, FN, TITLE, EMAIL… in vCard, and SUMMARY, DESCRIPTION, LOCATION… in iCalendar. Its documentation says unescaped commas "are not delimiters". Yet it inheritsText::setRawMimeDirValue(), which splits values on them.RFC 6350 and RFC 5545 require commas in text to be escaped, but many producers don't. When they don't, the value is split into several parts. That breaks reading in two ways:
getValue()returns the value escaped again. For multi-part values,Property::getValue()returnsgetRawMimeDirValue(), so newlines come back as a literal\n, and backslashes and semicolons come back escaped:getValue()beforeNOTE:Line 1\nLine 2Line 1⏎Line 2NOTE:Line 1\nLine 2, and moreLine 1\nLine 2, and more(literal\n)Line 1⏎Line 2, and morejCard/jCal gets several values where there is one:
FN:Doe, Janegives["fn", {}, "text", "Doe", " Jane"].Change
FlatText::setRawMimeDirValue()unescapes the value without splitting it.As a result, an unescaped comma is now written back escaped (
FN:Doe\, Jane), as the RFCs require.LineFoldingIssueTestrelied on the unescaped comma being written back as is. Its data originally hadTEST\, TEST, and bedefa1 ("Tweaked test to come out correctly") removed the backslash so that the output matched the input. This PR restores the escaped comma, checks the value, and expects the line folded at 75 octets, since it is now one octet longer.Tests
tests/VObject/Property/FlatTextTest.phpcovers a vCard NOTE, an iCalendar DESCRIPTION, an escaped comma, the jCard value, and writing. Four of its tests fail without the fix.🤖 Generated with Claude Code