Bug #13981
closedPHP Error on ``status_interfaces.php`` with empty switch VLAN group configuration and assigned VLAN interfaces
100%
Description
Devices with switches are hitting this after upgrading to 23.01.
PHP Errors: [17-Feb-2023 21:21:44 Europe/Paris] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /usr/local/www/status_interfaces.php:137 Stack trace: #0 {main} thrown in /usr/local/www/status_interfaces.php on line 137
Reported in 3100 and 2100
Updated by Steve Wheeler almost 2 years ago
This is triggered by the presence of empty <vlangroups> tags in the switch config which are not usually there.
They can end up there if you set the switch in .1q mode, add a vlan group and then set it back to port vlan mode.
Updated by Marcos M almost 2 years ago
For reference, the <vlangroups>
element in /cf/conf/config.xml
can be removed to work around the issue (e.g. by using Diagnostics / Edit File).
Updated by Jim Pingle almost 2 years ago
- Category changed from Web Interface to Interfaces
- Status changed from New to In Progress
- Assignee set to Jim Pingle
Updated by Jim Pingle almost 2 years ago
To trigger this you also need at least one assigned VLAN tagged interface -- it need not be on the switch interface.
Updated by Jim Pingle almost 2 years ago
- Subject changed from PHP Error: /usr/local/www/status_interfaces.php:137 to PHP Error on ``status_interfaces.php`` with empty switch VLAN group configuration and assigned VLAN interfaces
Updated by Jim Pingle almost 2 years ago
- Status changed from In Progress to Feedback
- % Done changed from 0 to 100
Fix committed to plus tree (5841d5850265476100b719e60e38b65887cd1460
).
You can install the System Patches package and then create an entry for the diff below to apply the fix.
diff --git a/src/usr/local/www/status_interfaces.php b/src/usr/local/www/status_interfaces.php
index 77a0071870..2dd1d7fa16 100644
--- a/src/usr/local/www/status_interfaces.php
+++ b/src/usr/local/www/status_interfaces.php
@@ -134,8 +134,8 @@ foreach ($ifdescrs as $ifdescr => $ifname):
$ifhwinfo = $ifinfo['hwif'];
$vlan = interface_is_vlan($ifinfo['hwif']);
- if ($vlan && is_array($config['switches']['switch'][0]['vlangroups']['vlangroup'])) {
- foreach ($config['switches']['switch'][0]['vlangroups']['vlangroup'] as $vlangroup) {
+ if ($vlan) {
+ foreach (config_get_path('switches/switch/0/vlangroups/vlangroup', []) as $vlangroup) {
if ($vlangroup['vlanid'] == $vlan['tag']) {
$ifhwinfo .= ', switchports: ' . $vlangroup['members'];
break;
Updated by Danilo Zrenjanin almost 2 years ago
- Status changed from Feedback to Resolved
Replicated the issue on SG-2100.
23.01-RELEASE (amd64) built on Fri Feb 10 20:06:33 UTC 2023 FreeBSD 14.0-CURRENT
The patch fixes it. I am marking the ticket as resovled.