Skip to content

Commit 0a0334e

Browse files
committed
Fix error on principal-property-search report without requested properties
Fixes #989
1 parent 09ac4fd commit 0a0334e

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

lib/DAVACL/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ protected function principalPropertySearchReport($path, Xml\Request\PrincipalPro
14271427
}
14281428
$result = $this->principalSearch(
14291429
$report->searchProperties,
1430-
$report->properties,
1430+
(array) $report->properties,
14311431
$path,
14321432
$report->test
14331433
);

tests/Sabre/DAVACL/PrincipalPropertySearchTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,36 @@ public function testWrongUri()
375375
self::assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString());
376376
}
377377
}
378+
379+
public function testEmptyRequestProperties()
380+
{
381+
$xml = '<?xml version="1.0"?>
382+
<d:principal-property-search xmlns:d="DAV:">
383+
<d:property-search>
384+
<d:prop>
385+
<d:displayname />
386+
</d:prop>
387+
<d:match>1</d:match>
388+
</d:property-search>
389+
</d:principal-property-search>';
390+
391+
$serverVars = [
392+
'REQUEST_METHOD' => 'REPORT',
393+
'HTTP_DEPTH' => '0',
394+
'REQUEST_URI' => '/principals',
395+
];
396+
397+
$request = HTTP\Sapi::createFromServerArray($serverVars);
398+
$request->setBody($xml);
399+
400+
$server = $this->getServer();
401+
$server->httpRequest = $request;
402+
403+
$server->exec();
404+
405+
self::assertEquals(207, $server->httpResponse->getStatus());
406+
self::assertStringContainsString('/principals/user1/', $server->httpResponse->getBodyAsString());
407+
}
378408
}
379409

380410
class MockPlugin extends Plugin

0 commit comments

Comments
 (0)