From b4a676a4e758a565d94b9bc9e01570a7fce14235 Mon Sep 17 00:00:00 2001 From: Vadim Pisarev Date: Wed, 22 Nov 2023 00:13:03 -0500 Subject: [PATCH] Single vlan handling fix --- lib/php/Converter.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/php/Converter.php b/lib/php/Converter.php index 437b7d6..ada5153 100644 --- a/lib/php/Converter.php +++ b/lib/php/Converter.php @@ -1409,9 +1409,10 @@ public function convertNetworkInventory(array $data): array //check for arrays foreach ($data['content']['network_ports'] as &$netport) { if (isset($netport['vlans'])) { - $netport['vlans'] = array_is_list($netport['vlans']['vlan']) ? - $netport['vlans']['vlan'] : - [$netport['vlans']['vlan']]; + $netport['vlans'] = is_array($netport['vlans']['vlan']) + && array_is_list($netport['vlans']['vlan']) + ? $netport['vlans']['vlan'] + : [$netport['vlans']['vlan']]; } if (isset($netport['connections']['cdp'])) { $netport['lldp'] = (bool)$netport['connections']['cdp'];