From 6b39b25e209d5f0d5c8e123a6bb2e6aec0d621bf Mon Sep 17 00:00:00 2001 From: azt3k Date: Fri, 27 Apr 2018 17:14:57 +1200 Subject: [PATCH] Fixes a count() php warning without an api change Warning: count(): Parameter must be an array or an object that implements Countable in /path/to/vendor/silverstripe/framework/src/Security/Member.php on line 1355 --- src/Security/Member.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Security/Member.php b/src/Security/Member.php index 38be3f716..7712a692c 100644 --- a/src/Security/Member.php +++ b/src/Security/Member.php @@ -1347,6 +1347,12 @@ class Member extends DataObject */ public static function mapInCMSGroups($groups = null) { + + // non-countable $groups will issue a warning when using count() in PHP 7.2+ + if (!$groups) { + $groups = []; + } + // Check CMS module exists if (!class_exists(LeftAndMain::class)) { return ArrayList::create()->map();