mirror of
https://github.com/opnsense/core.git
synced 2026-10-12 02:20:36 +00:00
System: Gateways: Configuration - ensure proper types are emitted in searchGatewayAction() when configd action fails.
should prevent hard failures like: TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /usr/local/opnsense/mvc/app/controllers/OPNsense/Routing/Api/SettingsController.php:122 Stack trace: #0
This commit is contained in:
@@ -54,8 +54,8 @@ class SettingsController extends ApiMutableModelControllerBase
|
||||
public function searchGatewayAction()
|
||||
{
|
||||
$cfg = Config::getInstance()->object();
|
||||
$ifconfig = json_decode((new Backend())->configdRun('interface list ifconfig'), true);
|
||||
$gateways_status = json_decode((new Backend())->configdRun('interface gateways status'), true);
|
||||
$ifconfig = json_decode((new Backend())->configdRun('interface list ifconfig'), true) ?? [];
|
||||
$gateways_status = json_decode((new Backend())->configdRun('interface gateways status'), true) ?? [];
|
||||
$gateways = array_values($this->getModel()->gatewaysIndexedByName(true, false, true));
|
||||
$down_gateways = !empty((string)$cfg->system->gw_switch_default) ? array_map(function ($gw) {
|
||||
if (str_contains($gw['status'], 'down')) {
|
||||
|
||||
Reference in New Issue
Block a user