Skip to content

fix: Read a VALUE parameter that lists several types - #27

Merged
odolbeau merged 1 commit into
mainfrom
fix-multiple-values
Oct 3, 2026
Merged

odolbeau merged 1 commit into
mainfrom
fix-multiple-values

Conversation

@odolbeau

@odolbeau odolbeau commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Problem

$vcf = "BEGIN:VCARD\r\nVERSION:3.0\r\nFN:Jane Doe\r\nURL;TYPE=work;VALUE=uri,text:https://jane.example\r\nEND:VCARD\r\n";
(new VCardDecoder())->decode($vcf);

gave an empty card and the issue not a valid vCard: Sabre\VObject\Document::getClassNameForPropertyValue(): Argument #1 ($valueParam) must be of type string, array given. sabre/vobject reads VALUE=uri,text as a list and passes an array where it expects a string. ez-vcard writes such lines.

The Parser already worked around a repeated VALUE (VALUE=text;VALUE=TEXT), not a listed one.

Fix

In the Parser pre-processing, before sabre sees the line: a VALUE parameter with several values, repeated, listed or both, is reduced to its first value, and an issue reports it:

  • line N repeats the VALUE parameter, kept the first one (unchanged)
  • line N lists several values in the VALUE parameter, kept the first one (new)

Only that property is affected, and the rest of the card is read as usual. A quoted VALUE="uri,text" is left alone, because sabre reads it as a single string and doesn't crash.

Keeping the types as is would not have kept them either: with VALUE="uri,text", the URL round-trips but the VALUE is dropped without any issue.

Upstream

The bug is in sabre/vobject (sabre-io/vobject#635). sabre-io/vobject#795 fixes it for both repeated and listed values. This workaround stays until we require a release that includes it; removing it is tracked in #5 (updated to cover listed values).

Tests

  • testListedValueParametersAreReported: the vCard above is read (FN, URL with its context), the issue is reported, and vCard → JSContact → vCard keeps the URL.
  • testRepeatedAndListedValueParametersAreReported: both at once.

make qa passes.

🤖 Generated with Claude Code

URL;VALUE=uri,text:… (written by ez-vcard) made sabre/vobject 5.0 throw
a TypeError, and the whole card was lost. The Parser now keeps the first
value of a repeated or listed VALUE parameter, and reports it.

Upstream fix: sabre-io/vobject#795. Removing this workaround: #5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@odolbeau
odolbeau merged commit 60b35a1 into main Oct 3, 2026
4 checks passed
@odolbeau
odolbeau deleted the fix-multiple-values branch October 3, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant