summaryrefslogtreecommitdiffstats
path: root/1006.patch
blob: b20ebb0f3dd30eae68d8885bb064e9cc57d8523b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 89914212677c23e680a9de57b56801062aed0f3f Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 6 Oct 2017 15:51:42 +0200
Subject: [PATCH] fix "count(): Parameter must be an array or an object that
 implements Countable" (7.2)

---
 lib/DAVACL/Plugin.php                      |  2 +-
 tests/Sabre/CalDAV/ICSExportPluginTest.php | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/DAVACL/Plugin.php b/lib/DAVACL/Plugin.php
index a2aa118d70..a5c8ac5c20 100644
--- a/lib/DAVACL/Plugin.php
+++ b/lib/DAVACL/Plugin.php
@@ -1400,7 +1400,7 @@ protected function expandProperties($path, array $requestedProperties, $depth) {
             foreach ($requestedProperties as $propertyName => $childRequestedProperties) {
 
                 // We're only traversing if sub-properties were requested
-                if (count($childRequestedProperties) === 0) continue;
+                if (!is_array($childRequestedProperties) || count($childRequestedProperties) === 0) continue;
 
                 // We only have to do the expansion if the property was found
                 // and it contains an href element.
diff --git a/tests/Sabre/CalDAV/ICSExportPluginTest.php b/tests/Sabre/CalDAV/ICSExportPluginTest.php
index 75412577e9..1df0dfac58 100644
--- a/tests/Sabre/CalDAV/ICSExportPluginTest.php
+++ b/tests/Sabre/CalDAV/ICSExportPluginTest.php
@@ -212,8 +212,8 @@ function testFilterStartEnd() {
 
         $obj = VObject\Reader::read($response->getBody());
 
-        $this->assertEquals(0, count($obj->VTIMEZONE));
-        $this->assertEquals(0, count($obj->VEVENT));
+        $this->assertNull($obj->VTIMEZONE);
+        $this->assertNull($obj->VEVENT);
 
     }
 
@@ -237,7 +237,7 @@ function testExpand() {
 
         $obj = VObject\Reader::read($response->getBody());
 
-        $this->assertEquals(0, count($obj->VTIMEZONE));
+        $this->assertNull($obj->VTIMEZONE);
         $this->assertEquals(1, count($obj->VEVENT));
 
     }
@@ -292,7 +292,7 @@ function testFilterComponentVEVENT() {
         $obj = VObject\Reader::read($response->body);
         $this->assertEquals(1, count($obj->VTIMEZONE));
         $this->assertEquals(1, count($obj->VEVENT));
-        $this->assertEquals(0, count($obj->VTODO));
+        $this->assertNull($obj->VTODO);
 
     }
 
@@ -307,8 +307,8 @@ function testFilterComponentVTODO() {
 
         $obj = VObject\Reader::read($response->body);
 
-        $this->assertEquals(0, count($obj->VTIMEZONE));
-        $this->assertEquals(0, count($obj->VEVENT));
+        $this->assertNull($obj->VTIMEZONE);
+        $this->assertNull($obj->VEVENT);
         $this->assertEquals(1, count($obj->VTODO));
 
     }