From 42659793c8ed66bf6465909c67dee3cc61325eb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Wed, 11 Sep 2019 09:26:16 +0200
Subject: [PATCH] :ambulance: fix(config) Avoid using count on non-existing var

issue #6026
---
 include/class_config.inc | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/include/class_config.inc b/include/class_config.inc
index fdf99e775..59b652606 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -800,13 +800,6 @@ class config
     /* Walk through array */
     ksort($arr);
     foreach ($arr as $name => $entries) {
-
-      /* If this department is the last in the current tree position
-       * remove it, to avoid generating output for it */
-      if (count($entries['SUB']) == 0) {
-        unset($entries['SUB']);
-      }
-
       /* Fix name, if it contains a replace tag */
       $name = preg_replace('/\\\\,/', ',', $name);
 
@@ -825,7 +818,7 @@ class config
       }
 
       /* recursive add of subdepartments */
-      if (isset($entries['SUB'])) {
+      if (!empty($entries['SUB'])) {
         $ret = array_merge($ret, $this->generateDepartmentArray($entries['SUB'], $depth, $max_size));
       }
     }
-- 
GitLab