mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
fdb-table.inc.php: Fix SQL constrain violation, 'port_id' cannot be null (#11055)
* fix SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'port_id' cannot be null * If $entry['port_id'] truly is null (on insert) then Illuminate throws a fatal error and all subsequent processing stops. * Cisco ISO (and others) may have null ids. We still want them inserted as new * strings work with DB::table->insert().
This commit is contained in:
committed by
PipoCanaja
parent
f99c45b4c1
commit
3629db9464
@@ -57,6 +57,14 @@ if (!empty($insert)) {
|
||||
}
|
||||
unset($existing_fdbs[$vlan_id][$mac_address_entry]);
|
||||
} else {
|
||||
if (is_null($entry['port_id'])) {
|
||||
// fix SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'port_id' cannot be null
|
||||
// If $entry['port_id'] truly is null then Illuminate throws a fatal errory and all subsequent processing stops.
|
||||
// Cisco ISO (and others) may have null ids. We still want them inserted as new
|
||||
// strings work with DB::table->insert().
|
||||
$entry['port_id']='';
|
||||
}
|
||||
|
||||
DB::table('ports_fdb')->insert([
|
||||
'port_id' => $entry['port_id'],
|
||||
'mac_address' => $mac_address_entry,
|
||||
|
Reference in New Issue
Block a user