From 4d26c73e6dfcb96f1e880360e28254ff8cd548ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Thu, 24 Jan 2019 14:25:57 +0100
Subject: [PATCH] :ambulance: fix(5135) Fix management config loading

issue #5135
---
 include/class_config.inc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/include/class_config.inc b/include/class_config.inc
index ae152d3c0..c0b772302 100644
--- a/include/class_config.inc
+++ b/include/class_config.inc
@@ -513,10 +513,13 @@ class config
   private function loadManagementConfig()
   {
     if (isset($this->current['MANAGEMENTCONFIG'])) {
+      if (!is_array($this->current['MANAGEMENTCONFIG'])) {
+        $this->current['MANAGEMENTCONFIG'] = array($this->current['MANAGEMENTCONFIG']);
+      }
       $value = array();
-      foreach ($this->current['MANAGEMENTCONFIG'] as $value) {
-        list($class, $config) = explode(':', $value, 2);
-        $value[$class] = $config;
+      foreach ($this->current['MANAGEMENTCONFIG'] as $config) {
+        list($class, $json) = explode(':', $config, 2);
+        $value[$class] = $json;
       }
       $this->current['MANAGEMENTCONFIG'] = $value;
     }
@@ -552,6 +555,8 @@ class config
     if (!$ldap->modify_batch($changes)) {
       return array($ldap->get_error());
     }
+    $this->current['MANAGEMENTCONFIG'][$managementClass] = $managementConfig;
+    return array();
   }
 
   /*!
-- 
GitLab