Gateways: Single: Migrate to MVC - Minor regression in first part of https://github.com/opnsense/core/pull/6808

if the gateway structure contains a <gateway_item/> as first element, technically speaking $config->gateways->gateway_item is empty. Better to check for children when gateway isn't empty to prevent none of the gateways being rendered in these cases.
This commit is contained in:
Ad Schellevis 2023-11-01 09:56:40 +01:00
parent f02a17a4e6
commit c0cbbcc8e5

View File

@ -220,7 +220,7 @@ class Gateways extends BaseModel
if ($use_legacy) {
$config = Config::getInstance()->object();
if (!empty($config->gateways) && !empty($config->gateways->gateway_item)) {
if (!empty($config->gateways) && count($config->gateways->children()) > 0) {
foreach ($config->gateways->children() as $tag => $gateway) {
if ($tag == 'gateway_item') {
$record = [];