Add PHP 8 array guards in gamemanager and addonsmanager modules

Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/88949fe0-8891-483a-b5c5-952bc209748d

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-20 12:39:25 +00:00 committed by GitHub
parent 5b80f144e4
commit 54e7f07aa0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 141 additions and 63 deletions

View file

@ -79,14 +79,16 @@ if(isset($_POST['command']) and !is_array($_POST['command']))
$_POST['command'] = array( '0' => stripcslashes($_POST['command']) );
elseif(isset($_POST['base64_command']))
{
foreach($_POST['base64_command'] as $key => $command)
{
$_POST['command'][$key] = isset($_POST['input']) ? str_replace("%input%", $_POST['input'], base64_decode($command)) : base64_decode($command);
if (is_array($_POST['base64_command'])) {
foreach($_POST['base64_command'] as $key => $command)
{
$_POST['command'][$key] = isset($_POST['input']) ? str_replace("%input%", $_POST['input'], base64_decode($command)) : base64_decode($command);
}
}
}
$presets = $db->getRconPresets($home_info['home_cfg_id'],$home_info['mods'][$mod_id]['mod_cfg_id']);
if($presets > 0)
if(is_array($presets) && $presets > 0)
{
echo '<form action="" method="post">'.
get_lang("rcon_presets") . ':
@ -124,16 +126,22 @@ if($presets > 0)
if(isset($_POST['remote_send_rcon_command']))
{
$response = "";
foreach($_POST['command'] as $command)
{
$ret = send_command($command, $remote, $server_xml, $home_info, $home_id, $ip, $port );
if(!$ret)
if (is_array($_POST['command'])) {
foreach($_POST['command'] as $command)
{
$response = FALSE;
break;
$ret = send_command($command, $remote, $server_xml, $home_info, $home_id, $ip, $port );
if(!$ret)
{
$response = FALSE;
break;
}
else
$response .= $ret;
}
else
$response .= $ret;
}
else
{
$response = FALSE;
}
if($response)
{