summaryrefslogtreecommitdiffstats
path: root/5efb632b7a3a2fa76cf3ee76df650f1f2317a206.patch
blob: e85fe56748f328e47f8113685c3f8ac7e8a7c497 (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
From 5efb632b7a3a2fa76cf3ee76df650f1f2317a206 Mon Sep 17 00:00:00 2001
From: Jan Schneider <jan@horde.org>
Date: Fri, 25 Nov 2016 09:40:34 +0100
Subject: [PATCH] Fix count() usage.

Detected by PHP 7.2. count() should only be passed arrays and Countables.
---
 lib/Horde/Kolab/Server/Ldap/Changes.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/Horde/Kolab/Server/Ldap/Changes.php b/lib/Horde/Kolab/Server/Ldap/Changes.php
index 84a6ea0..348631f 100644
--- a/lib/Horde/Kolab/Server/Ldap/Changes.php
+++ b/lib/Horde/Kolab/Server/Ldap/Changes.php
@@ -77,9 +77,8 @@ public function getChangeset()
                 $cs['delete'][] = $attribute;
                 continue;
             }
-            if (count($new[$attribute]) == 1
-                && count($old[$attribute]) == 1
-            ) {
+            if ((!is_array($new[$attribute]) || count($new[$attribute]) == 1) &&
+                (!is_array($old[$attribute]) || count($old[$attribute]) == 1)) {
                 if ($new[$attribute][0] == $old[$attribute][0]) {
                     continue;
                 } else {