php8 style issues - fix PHP Deprecated: ... Passing null to parameter errors and some undefined array keys

This commit is contained in:
Ad Schellevis 2023-01-25 15:17:05 +01:00
parent a772579ed9
commit b15d17b847
3 changed files with 5 additions and 3 deletions

View File

@ -75,6 +75,8 @@ function legacy_html_escape_form_data(&$settings)
foreach ($settings as $dataKey => &$dataValue) {
if (is_array($dataValue)) {
legacy_html_escape_form_data($dataValue);
} elseif ($dataValue === null) {
$settings[$dataKey] = '';
} else {
$settings[$dataKey] = htmlspecialchars($dataValue, ENT_QUOTES | ENT_HTML401);
}

View File

@ -34,7 +34,7 @@ require_once("guiconfig.inc");
$a_group = &config_read_array('system', 'group');
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (isset($a_group[$_GET['groupid']])) {
if (isset($_GET['groupid']) && isset($a_group[$_GET['groupid']])) {
$id = $_GET['groupid'];
}
if (isset($_GET['act']) && ($_GET['act'] == 'edit' || $_GET['act'] == 'new')) {
@ -436,7 +436,7 @@ $( document ).ready(function() {
class="btn btn-default btn-xs" data-toggle="tooltip" title="<?= html_safe(gettext('Edit')) ?>">
<span class="fa fa-pencil fa-fw"></span>
</a>
<?php if ($group['scope'] != 'system'): ?>
<?php if (isset($group['scope']) && $group['scope'] != 'system'): ?>
<button type="button" class="btn btn-default btn-xs act-del-group"
data-groupname="<?=$group['name'];?>"
data-groupid="<?=$i?>" title="<?= html_safe(gettext('Delete')) ?>" data-toggle="tooltip">

View File

@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$savemsg = gettext('Your password does not match the selected security policies. Please provide a new one.');
}
$pconfig['language'] = $userFound ? $config['system']['user'][$userindex[$username]]['language'] : null;
$pconfig['language'] = $userFound ? $config['system']['user'][$userindex[$username]]['language'] ?? '' : null;
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$input_errors = array();
$pconfig = $_POST;