Private GIT

Skip to content
Snippets Groups Projects
Commit 24eab99e authored by omercier's avatar omercier Committed by loiclau
Browse files

Fix uninitialized array causing php warning (#6046)

When $res->fetch() brings nothing, $listName is undefined and generates this warning :
PHP Warning:  in_array() expects parameter 2 to be array, null given in /usr/share/centreon/www/class/centreon-clapi/centreonCentbrokerCfg.class.php on line 411
So I suggest to initialize it as an empty array before.
parent 49f96bde
Branches
Tags
No related merge requests found
......@@ -404,11 +404,10 @@ class CentreonCentbrokerCfg extends CentreonObject
"AND config_key = 'name' " .
"AND config_group = ? ";
$res = $this->db->query($sql, array($configId, $tagName));
$listName[] = array();
while ($list = $res->fetch()) {
$listName[] = $list['config_value'];
}
if (in_array($args[1], $listName)) {
throw new CentreonClapiException(self::OBJECTALREADYEXISTS);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment