Skip to content

Commit

Permalink
Fix null dereference on param-filter check
Browse files Browse the repository at this point in the history
  • Loading branch information
mstilkerich authored and phil-davis committed Feb 12, 2021
1 parent 82ea0e9 commit 171e367
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion lib/CardDAV/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,14 @@ protected function validateParamFilters(array $vProperties, array $filters, $tes
foreach ($vProperties as $vProperty) {
// If we got all the way here, we'll need to validate the
// text-match filter.
$success = DAV\StringUtil::textMatch($vProperty[$filter['name']]->getValue(), $filter['text-match']['value'], $filter['text-match']['collation'], $filter['text-match']['match-type']);
if (isset($vProperty[$filter['name']])) {
$success = DAV\StringUtil::textMatch(
$vProperty[$filter['name']]->getValue(),
$filter['text-match']['value'],
$filter['text-match']['collation'],
$filter['text-match']['match-type']
);
}
if ($success) {
break;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Sabre/CardDAV/ValidateFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ public function data()
VERSION:3.0
ORG:Company;
TITLE:Title
ITEM4.TEL:(111) 11 11 11
ITEM5.TEL:(6) 66 66 66 66
ITEM6.TEL:(77) 777 77 77
TEL;TYPE=IPHONE;TYPE=pref:(222) 22 22 22
TEL;TYPE=HOME:(33) 333 66 66
TEL;TYPE=WORK:(444) 44 44 44
TEL;TYPE=MAIN:(55) 555 55 55
ITEM4.TEL:(111) 11 11 11
ITEM5.TEL:(6) 66 66 66 66
ITEM6.TEL:(77) 777 77 77
UID:3151DE6A-BC35-4612-B340-B53A034A2B27
ITEM1.EMAIL:[email protected]
ITEM2.EMAIL:[email protected]
Expand Down

0 comments on commit 171e367

Please sign in to comment.