From eec0d7636076e70d9f685bdb9201281aa5770da2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 29 Dec 2018 14:41:57 +0100 Subject: [PATCH] Fix regression in vcard parser --- program/lib/Roundcube/rcube_vcard.php | 5 +---- tests/Framework/VCard.php | 4 ++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/program/lib/Roundcube/rcube_vcard.php b/program/lib/Roundcube/rcube_vcard.php index d7064e80a..5610667af 100644 --- a/program/lib/Roundcube/rcube_vcard.php +++ b/program/lib/Roundcube/rcube_vcard.php @@ -814,10 +814,7 @@ class rcube_vcard if (count($parts = explode($sep, strtr($s, $rep1))) > 1) { foreach ($parts as $s) { - $s = self::vcard_unquote(strtr($s, $rep2)); - if (is_array($s) || (is_string($s) && strlen($s))) { - $result[] = $s; - } + $result[] = self::vcard_unquote(strtr($s, $rep2)); } return $result; } diff --git a/tests/Framework/VCard.php b/tests/Framework/VCard.php index 0374f6bdc..2827f9f01 100644 --- a/tests/Framework/VCard.php +++ b/tests/Framework/VCard.php @@ -163,6 +163,7 @@ class Framework_VCard extends PHPUnit_Framework_TestCase . "FN:Test\n" . "TEL;TYPE=home:67890\n" . "TEL;TYPE=CELL:\n" + . "ADR;TYPE=home:;;street;city;state;zip;country\n" . "END:VCARD" ); @@ -170,5 +171,8 @@ class Framework_VCard extends PHPUnit_Framework_TestCase $this->assertCount(1, $result['phone:home'], "TYPE=home entry exists"); $this->assertTrue(!isset($result['phone:mobile']), "TYPE=CELL entry ignored"); + $this->assertCount(5, $result['address:home'][0], "ADR with some fields missing"); + $this->assertEquals($result['address:home'][0]['zipcode'], 'zip', "ADR with some fields missing (1)"); + $this->assertEquals($result['address:home'][0]['street'], 'street', "ADR with some fields missing (2)"); } }