Verified Commit 7ae44c39 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(dhcp) Avoid crash in DHCP tab of network devices

IPs and Macs are not arrays in this case

issue #6063
Showing with 14 additions and 1 deletion
+14 -1
...@@ -156,10 +156,23 @@ class DhcpHostsAttribute extends OrderedArrayAttribute ...@@ -156,10 +156,23 @@ class DhcpHostsAttribute extends OrderedArrayAttribute
} }
/* Special LDAP treatment that this attribute does after plugin ldap save */ /* Special LDAP treatment that this attribute does after plugin ldap save */
function postLdapSave ($ldap, $fullrewrite, $ipchanged, array $oldips, array $newips, $macchanged, array $oldmacs, array $newmacs) function postLdapSave ($ldap, $fullrewrite, $ipchanged, $oldips, $newips, $macchanged, $oldmacs, $newmacs)
{ {
global $config, $ui; global $config, $ui;
if (!is_array($oldips)) {
$oldips = [$oldips];
}
if (!is_array($newips)) {
$newips = [$newips];
}
if (!is_array($oldmacs)) {
$oldmacs = [$oldmacs];
}
if (!is_array($newmacs)) {
$newmacs = [$newmacs];
}
if ($this->plugin->is_template) { if ($this->plugin->is_template) {
return; return;
} }
......
  • SonarQube analysis reported 3 issues

    • :warning: 3 major

    Note: The following issues were found on lines that were not modified in the commit. Because these issues can't be reported as line comments, they are summarized here:

    1. :warning: This function "getAttributesInfo" has 175 lines, which is greater than the 150 lines authorized. Split it into smaller functions. :blue_book:
    2. :warning: This function "getUserValues" has 206 lines, which is greater than the 150 lines authorized. Split it into smaller functions. :blue_book:
    3. :warning: Remove this unused "$class" local variable. :blue_book:
  • mentioned in commit 19b273eb

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment