From 89914212677c23e680a9de57b56801062aed0f3f Mon Sep 17 00:00:00 2001 From: Remi Collet 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)); }