firewall_nat_edit.php fix "PHP Warning: in_array() expects parameter 2 to be array, null given in /usr/local/www/firewall_nat_edit.php on line 542" when interface is missing, closes https://github.com/opnsense/core/pull/4407

This commit is contained in:
Ad Schellevis 2020-10-13 22:18:56 +02:00
parent e7c01545bf
commit 327850e1b0

View File

@ -539,7 +539,7 @@ $( document ).ready(function() {
<select name="interface[]" class="selectpicker" data-width="auto" data-live-search="true" multiple="multiple">
<?php
foreach (legacy_config_get_interfaces(array("enable" => true)) as $iface => $ifdetail): ?>
<option value="<?=$iface;?>" <?= in_array($iface, $pconfig['interface']) ? "selected=\"selected\"" : ""; ?>>
<option value="<?=$iface;?>" <?= in_array($iface, $pconfig['interface'] ?? []) ? "selected=\"selected\"" : ""; ?>>
<?=htmlspecialchars($ifdetail['descr']);?>
</option>
<?php endforeach; ?>