From a71ccdabe6a1e98e258bd4e67d49ea1085e8728c Mon Sep 17 00:00:00 2001
From: Paul Mehrer
Date: Fri, 5 Jul 2024 15:45:20 +0200
Subject: [PATCH 1/2] DAV\PropPatch::handleRemaining should only register one
callback
---
lib/DAV/PropPatch.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/DAV/PropPatch.php b/lib/DAV/PropPatch.php
index 092909dea8..71187b02e1 100644
--- a/lib/DAV/PropPatch.php
+++ b/lib/DAV/PropPatch.php
@@ -123,12 +123,12 @@ public function handleRemaining(callable $callback)
foreach ($properties as $propertyName) {
// HTTP Accepted
$this->result[$propertyName] = 202;
-
- $this->propertyUpdateCallbacks[] = [
- $properties,
- $callback,
- ];
}
+
+ $this->propertyUpdateCallbacks[] = [
+ $properties,
+ $callback,
+ ];
}
/**
From 22add11673e9953e9b9a449a1c3423e2fd481778 Mon Sep 17 00:00:00 2001
From: Paul Mehrer
Date: Fri, 6 Sep 2024 15:02:07 +0200
Subject: [PATCH 2/2] added prop patch handle multiple remaining test
---
tests/Sabre/DAV/PropPatchTest.php | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/tests/Sabre/DAV/PropPatchTest.php b/tests/Sabre/DAV/PropPatchTest.php
index 2f71dc357e..1ae9545eea 100644
--- a/tests/Sabre/DAV/PropPatchTest.php
+++ b/tests/Sabre/DAV/PropPatchTest.php
@@ -121,6 +121,32 @@ public function testHandleRemaining()
self::assertTrue($hasRan);
}
+ public function testHandleMultipleRemaining()
+ {
+ $cunCounter = 0;
+
+ $this->propPatch = new PropPatch([
+ '{DAV:}displayname' => 'foo',
+ 'unittest' => 'bar',
+ ]);
+
+ $this->propPatch->handleRemaining(function ($mutations) use (&$cunCounter) {
+ ++$cunCounter;
+ self::assertCount(2, $mutations);
+
+ return true;
+ });
+
+ self::assertTrue($this->propPatch->commit());
+ $result = $this->propPatch->getResult();
+ self::assertEquals([
+ '{DAV:}displayname' => 200,
+ 'unittest' => 200,
+ ], $result);
+
+ self::assertSame(1, $cunCounter);
+ }
+
public function testHandleRemainingNothingToDo()
{
$hasRan = false;