From a9c5d56abf49376b1acfecb87e3fcb84e3c6c88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20M=C3=B8llerh=C3=B8j?= Date: Tue, 8 Sep 2026 09:52:20 +0200 Subject: [PATCH 1/5] Added testcase --- tests/VObject/Property/UriTest.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/VObject/Property/UriTest.php b/tests/VObject/Property/UriTest.php index edb7cc393..5c6322049 100644 --- a/tests/VObject/Property/UriTest.php +++ b/tests/VObject/Property/UriTest.php @@ -23,4 +23,17 @@ public function testAlwaysEncodeUriVCalendar(): void $output = Reader::read($input)->serialize(); self::assertStringContainsString('URL;VALUE=URI:http://example.org/', $output); } + + public function testNoEscapeForDataValue() { + $input = <<PHOTO->serialize(), + "Comma is not escaped"); + } } From da1be68087ed46099f9f8b86f21a8acd5ded9350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20M=C3=B8llerh=C3=B8j?= Date: Wed, 9 Sep 2026 09:46:36 +0200 Subject: [PATCH 2/5] Fix: Don't escape comma in Uri values --- lib/Property/Uri.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Property/Uri.php b/lib/Property/Uri.php index dce7bf4bb..1a871d0b9 100644 --- a/lib/Property/Uri.php +++ b/lib/Property/Uri.php @@ -91,11 +91,9 @@ public function setRawMimeDirValue(string $val): void public function getRawMimeDirValue(): string { if (is_array($this->value)) { - $value = $this->value[0]; + return $this->value[0]; } else { - $value = $this->value; + return $this->value; } - - return strtr($value, [',' => '\,']); } } From 2f54609026e515411a9683f90ad249c6ff7a6e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20M=C3=B8llerh=C3=B8j?= Date: Wed, 9 Sep 2026 10:09:07 +0200 Subject: [PATCH 3/5] Rewrite of old testcase testRFC6350Section6Part5Part2 --- tests/VObject/Parser/XmlTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/VObject/Parser/XmlTest.php b/tests/VObject/Parser/XmlTest.php index 223b0f105..7990992b0 100644 --- a/tests/VObject/Parser/XmlTest.php +++ b/tests/VObject/Parser/XmlTest.php @@ -2126,6 +2126,10 @@ public function testRFC6350Section6Part5Part1(): void */ public function testRFC6350Section6Part5Part2(): void { + /* + * Note: We do not expect the comma in the Uri value of the GEO property to + * be escaped + */ self::assertXMLEqualsToMimeDir( << @@ -2139,7 +2143,7 @@ public function testRFC6350Section6Part5Part2(): void XML, 'BEGIN:VCARD'."\n". 'VERSION:4.0'."\n". - 'GEO:geo:37.386013\,-122.082932'."\n". + 'GEO:geo:37.386013,-122.082932'."\n". 'END:VCARD'."\n" ); From 09b0bfa6a43bc44df570f6b990f28674fd5f4414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20M=C3=B8llerh=C3=B8j?= Date: Fri, 11 Sep 2026 12:02:43 +0200 Subject: [PATCH 4/5] Ran php-cs-fixer --- lib/Property/Uri.php | 4 ++-- tests/VObject/Parser/XmlTest.php | 8 ++++---- tests/VObject/Property/UriTest.php | 13 +++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/Property/Uri.php b/lib/Property/Uri.php index 1a871d0b9..3d3fa6f21 100644 --- a/lib/Property/Uri.php +++ b/lib/Property/Uri.php @@ -92,8 +92,8 @@ public function getRawMimeDirValue(): string { if (is_array($this->value)) { return $this->value[0]; - } else { - return $this->value; } + + return $this->value; } } diff --git a/tests/VObject/Parser/XmlTest.php b/tests/VObject/Parser/XmlTest.php index 7990992b0..1ed1c83d9 100644 --- a/tests/VObject/Parser/XmlTest.php +++ b/tests/VObject/Parser/XmlTest.php @@ -2126,10 +2126,10 @@ public function testRFC6350Section6Part5Part1(): void */ public function testRFC6350Section6Part5Part2(): void { - /* - * Note: We do not expect the comma in the Uri value of the GEO property to - * be escaped - */ + /* + * Note: We do not expect the comma in the Uri value of the GEO property to + * be escaped + */ self::assertXMLEqualsToMimeDir( << diff --git a/tests/VObject/Property/UriTest.php b/tests/VObject/Property/UriTest.php index 5c6322049..c8c3c14a1 100644 --- a/tests/VObject/Property/UriTest.php +++ b/tests/VObject/Property/UriTest.php @@ -24,16 +24,17 @@ public function testAlwaysEncodeUriVCalendar(): void self::assertStringContainsString('URL;VALUE=URI:http://example.org/', $output); } - public function testNoEscapeForDataValue() { + public function testNoEscapeForDataValue() + { $input = <<PHOTO->serialize(), - "Comma is not escaped"); - } + $vObject = Reader::read($input); + self::assertStringContainsString('data:image/jpeg;base64,MIICajCCAd', + $vObject->PHOTO->serialize(), + 'Comma is not escaped'); + } } From 13ffffa484e03d0379024171be68445ca27d106c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20M=C3=B8llerh=C3=B8j?= Date: Fri, 11 Sep 2026 12:04:53 +0200 Subject: [PATCH 5/5] Ran ./vendor/bin/rector process --- tests/VObject/Property/UriTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/VObject/Property/UriTest.php b/tests/VObject/Property/UriTest.php index c8c3c14a1..d0e75637b 100644 --- a/tests/VObject/Property/UriTest.php +++ b/tests/VObject/Property/UriTest.php @@ -26,12 +26,12 @@ public function testAlwaysEncodeUriVCalendar(): void public function testNoEscapeForDataValue() { - $input = <<PHOTO->serialize(),