From 47bef28ae358a4055bf44914fdf03dd14ee58033 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Fri, 14 Oct 2022 08:43:25 +0200 Subject: [PATCH] unbound: error while opening DoT page This is due to e5bace2969c, but since we view the overview page here I'm not even sure the decision about forward/dot can be correct since there will be no POST data about 'dot' or the type. [14-Oct-2022 08:28:20 Europe/Berlin] Exception: Error at /usr/local/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php:67 - Trying to access array offset on value of type null (errno=2) in /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:159 Stack trace: --- .../app/controllers/OPNsense/Unbound/Api/SettingsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php index 91367e92f..1b36c80b6 100644 --- a/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php +++ b/src/opnsense/mvc/app/controllers/OPNsense/Unbound/Api/SettingsController.php @@ -64,7 +64,7 @@ class SettingsController extends ApiMutableModelControllerBase $fn = preg_replace('/Dot/', 'Forward', $method); if (method_exists(get_class($this), $fn)) { // set the type to forward if the request came from the corresponding gui page or is explicitly set in the API call - if (preg_match("/forward/i", $this->request->getHTTPReferer()) || $this->request->getPost('dot')['type'] == 'forward') { + if (preg_match("/forward/i", $this->request->getHTTPReferer()) || ($this->request->getPost('dot') && $this->request->getPost('dot')['type'] == 'forward')) { $this->type = "forward"; } return $this->$fn(...$args);