From 5b8f903e53b4da98165b82a8e72c140204cf607a Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Wed, 11 Dec 2024 20:55:14 +0100 Subject: [PATCH] fix php warning: Undefined array key "XXX" in /usr/local/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php on line 95 --- src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php b/src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php index eb4c75155..a739bde9f 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php +++ b/src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php @@ -92,10 +92,11 @@ class SNatRule extends Rule $rule['disabled'] = true; } } elseif (preg_match("/^(wan|lan|opt[0-9]+)ip$/", $rule['target'], $matches)) { - $rule['target'] = "({$this->interfaceMapping["{$matches[1]}"]['if']}:0)"; if (empty($this->interfaceMapping["{$matches[1]}"])) { $this->log("SNAT / target missing"); $rule['disabled'] = true; + } else { + $rule['target'] = "({$this->interfaceMapping["{$matches[1]}"]['if']}:0)"; } } foreach (array("sourceport", "dstport", "natport") as $fieldname) {