Fix regression in vcard parser

pull/6841/head
Aleksander Machniak 6 years ago
parent 8dec8fb60a
commit eec0d76360

@ -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;
}

@ -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)");
}
}

Loading…
Cancel
Save