From b5d58406e35c30e86c2f063eb0adabb30d269d6f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Oct 06 2017 13:57:13 +0000 Subject: add patch for PHP 7.2 from https://github.com/fruux/sabre-dav/pull/1006 --- diff --git a/1006.patch b/1006.patch new file mode 100644 index 0000000..b20ebb0 --- /dev/null +++ b/1006.patch @@ -0,0 +1,68 @@ +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)); + + } diff --git a/php-sabre-dav.spec b/php-sabre-dav.spec index 8f3b5f0..bc22c23 100644 --- a/php-sabre-dav.spec +++ b/php-sabre-dav.spec @@ -19,7 +19,7 @@ Name: php-%{gh_project} Summary: WebDAV Framework for PHP Version: 3.2.2 -Release: 2%{?dist} +Release: 3%{?dist} URL: https://github.com/%{gh_owner}/%{gh_project} License: BSD @@ -29,6 +29,8 @@ Source1: %{name}-autoload.php # replace composer autoloader Patch0: %{name}-autoload.patch +# For PHP 7.2 +Patch1: https://patch-diff.githubusercontent.com/raw/fruux/sabre-dav/pull/1006.patch BuildArch: noarch %if %{with_tests} @@ -140,6 +142,7 @@ Autoloader: %{_datadir}/php/Sabre/DAV/autoload.php %setup -q -n %{gh_project}-%{gh_commit} %patch0 -p1 -b .rpm +%patch1 -p1 cp %{SOURCE1} lib/DAV/autoload.php @@ -169,7 +172,13 @@ cd tests sed -e 's:@BUILDROOT@:%{buildroot}:' -i bootstrap.php : Run upstream test suite against installed library -%{_bindir}/phpunit --verbose +ret=0 +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit || ret=1 + fi +done +exit $ret %else : Skip upstream test suite %endif @@ -188,6 +197,9 @@ sed -e 's:@BUILDROOT@:%{buildroot}:' -i bootstrap.php %changelog +* Fri Oct 6 2017 Remi Collet - 3.2.2-3 +- add patch for PHP 7.2 from https://github.com/fruux/sabre-dav/pull/1006 + * Thu Jul 27 2017 Fedora Release Engineering - 3.2.2-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild