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:
This commit is contained in:
Franco Fichtner 2022-10-14 08:43:25 +02:00
parent 13391b3c7c
commit 47bef28ae3

View File

@ -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);