Skip to content

Commit e987775

Browse files
authored
Merge pull request #946 from fruux/carddav-addressdata-bug
Fix parsing bug for some CardDAV reports.
2 parents 11ba8e9 + 4daf9aa commit e987775

File tree

5 files changed

+59
-3
lines changed

5 files changed

+59
-3
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
ChangeLog
22
=========
33

4+
3.2.2 (2017-02-14)
5+
------------------
6+
7+
* #943: Fix CardDAV XML reporting bug, which was affecting several CardDAV
8+
clients. Bug was introduced in 3.2.1.
9+
* The zip release ships with [sabre/vobject 4.1.2][vobj],
10+
[sabre/http 4.2.2][http], [sabre/event 3.0.0][evnt],
11+
[sabre/uri 1.2.0][uri] and [sabre/xml 1.5.0][xml].
12+
13+
414
3.2.1 (2017-01-28)
515
------------------
616

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"psr/log": "^1.0"
3333
},
3434
"require-dev" : {
35-
"phpunit/phpunit" : "> 4.8, <=6.0.0",
35+
"phpunit/phpunit" : "> 4.8, <6.0.0",
3636
"evert/phpdoc-md" : "~0.1.0",
3737
"sabre/cs" : "^1.0.0",
3838
"monolog/monolog": "^1.18"

lib/CardDAV/Xml/Filter/AddressData.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static function xmlDeserialize(Reader $reader) {
5656
return $element['attributes']['name'];
5757
}, $elems);
5858

59-
$reader->next();
6059
return $result;
6160

6261
}

lib/DAV/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ class Version {
1414
/**
1515
* Full version number
1616
*/
17-
const VERSION = '3.2.1';
17+
const VERSION = '3.2.2';
1818

1919
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace Sabre\CardDAV\Xml\Request;
4+
5+
use Sabre\DAV\Xml\XmlTest;
6+
7+
class AddressBookMultiGetTest extends XmlTest {
8+
9+
protected $elementMap = [
10+
'{urn:ietf:params:xml:ns:carddav}addressbook-multiget' => 'Sabre\\CardDAV\\Xml\\Request\AddressBookMultiGetReport',
11+
];
12+
13+
function testDeserialize() {
14+
15+
/* lines look a bit odd but this triggers an XML parsing bug */
16+
$xml = <<<XML
17+
<?xml version='1.0' encoding='UTF-8' ?>
18+
<CARD:addressbook-multiget xmlns="DAV:" xmlns:CARD="urn:ietf:params:xml:ns:carddav">
19+
<prop>
20+
<getcontenttype />
21+
<getetag />
22+
<CARD:address-data content-type="text/vcard" version="4.0" /></prop><href>/foo.vcf</href>
23+
</CARD:addressbook-multiget>
24+
XML;
25+
26+
$result = $this->parse($xml);
27+
$addressBookMultiGetReport = new AddressBookMultiGetReport();
28+
$addressBookMultiGetReport->properties = [
29+
'{DAV:}getcontenttype',
30+
'{DAV:}getetag',
31+
'{urn:ietf:params:xml:ns:carddav}address-data',
32+
];
33+
$addressBookMultiGetReport->hrefs = ['/foo.vcf'];
34+
$addressBookMultiGetReport->contentType = 'text/vcard';
35+
$addressBookMultiGetReport->version = '4.0';
36+
$addressBookMultiGetReport->addressDataProperties = [];
37+
38+
39+
$this->assertEquals(
40+
$addressBookMultiGetReport,
41+
$result['value']
42+
);
43+
44+
}
45+
46+
47+
}

0 commit comments

Comments
 (0)