Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/DAVACL/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ protected function principalPropertySearchReport($path, Xml\Request\PrincipalPro
}
$result = $this->principalSearch(
$report->searchProperties,
$report->properties,
(array) $report->properties,
$path,
$report->test
);
Expand Down
30 changes: 30 additions & 0 deletions tests/Sabre/DAVACL/PrincipalPropertySearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,36 @@ public function testWrongUri()
self::assertEquals($count, count($result), 'we expected '.$count.' appearances of '.$xpath.' . We found '.count($result).'. Full response body: '.$server->httpResponse->getBodyAsString());
}
}

public function testEmptyRequestProperties()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function testEmptyRequestProperties()
public function testEmptyRequestProperties(): void

{
$xml = '<?xml version="1.0"?>
<d:principal-property-search xmlns:d="DAV:">
<d:property-search>
<d:prop>
<d:displayname />
</d:prop>
<d:match>1</d:match>
</d:property-search>
</d:principal-property-search>';

$serverVars = [
'REQUEST_METHOD' => 'REPORT',
'HTTP_DEPTH' => '0',
'REQUEST_URI' => '/principals',
];

$request = HTTP\Sapi::createFromServerArray($serverVars);
$request->setBody($xml);

$server = $this->getServer();
$server->httpRequest = $request;

$server->exec();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$server->exec();
$server->start();

exec is deprecated, let's not use it in new code :)


self::assertEquals(207, $server->httpResponse->getStatus());
self::assertStringContainsString('/principals/user1/', $server->httpResponse->getBodyAsString());
}
}

class MockPlugin extends Plugin
Expand Down