Apply automated PHP8 safety transforms

Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/89922108-1604-44ae-949d-358d32b9d70a

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-23 14:01:37 +00:00 committed by GitHub
parent aca850b6cd
commit e44519c030
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
465 changed files with 1716 additions and 1716 deletions

View file

@ -22,7 +22,7 @@ $input_separator = "A";
# value of the text control submitted for spell-checking
function print_textinputs_var() {
global $textinputs;
foreach( $textinputs as $key=>$val ) {
foreach ((array)$textinputs as $key=>$val ) {
# $val = str_replace( "'", "%27", $val );
echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n";
}
@ -43,10 +43,10 @@ function print_words_elem( $word, $index, $text_input_idx ) {
# set an element of the JavaScript 'suggs' array to a list of suggestions
function print_suggs_elem( $suggs, $index, $text_input_idx ) {
echo "suggs[$text_input_idx][$index] = [";
foreach( $suggs as $key=>$val ) {
foreach ((array)$suggs as $key=>$val ) {
if( $val ) {
echo "'" . escape_quote( $val ) . "'";
if ( $key+1 < count( $suggs )) {
if ( $key+1 < count((array)$suggs)) {
echo ", ";
}
}
@ -80,7 +80,7 @@ function print_checker_results() {
# open temp file, add the submitted text.
if( $fh = fopen( $tempfile, 'w' )) {
for( $i = 0; $i < count( $textinputs ); $i++ ) {
for( $i = 0; $i < count((array)$textinputs); $i++ ) {
$text = urldecode( $textinputs[$i] );
// Strip all tags for the text. (by FredCK - #339 / #681)
@ -90,7 +90,7 @@ function print_checker_results() {
fwrite ( $fh, "%\n" ); # exit terse mode
fwrite ( $fh, "^$input_separator\n" );
fwrite ( $fh, "!\n" ); # enter terse mode
foreach( $lines as $key=>$value ) {
foreach ((array)$lines as $key=>$value ) {
# use carat on each line to escape possible aspell commands
fwrite( $fh, "^$value\n" );
}
@ -104,7 +104,7 @@ function print_checker_results() {
$index = 0;
$text_input_index = -1;
# parse each line of aspell return
foreach( $linesout as $key=>$val ) {
foreach ((array)$linesout as $key=>$val ) {
$chardesc = substr( $val, 0, 1 );
# if '&', then not in dictionary but has suggestions
# if '#', then not in dictionary and no suggestions

View file

@ -44,7 +44,7 @@ function GetFolders( $resourceType, $currentFolder )
echo "<Folders>" ;
natcasesort( $aFolders ) ;
foreach ( $aFolders as $sFolder )
foreach ((array)$aFolders as $sFolder)
echo $sFolder ;
// Close the "Folders" node.
@ -89,7 +89,7 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
natcasesort( $aFolders ) ;
echo '<Folders>' ;
foreach ( $aFolders as $sFolder )
foreach ((array)$aFolders as $sFolder)
echo $sFolder ;
echo '</Folders>' ;
@ -98,7 +98,7 @@ function GetFoldersAndFiles( $resourceType, $currentFolder )
natcasesort( $aFiles ) ;
echo '<Files>' ;
foreach ( $aFiles as $sFiles )
foreach ((array)$aFiles as $sFiles)
echo $sFiles ;
echo '</Files>' ;

View file

@ -195,10 +195,10 @@ function IsAllowedExt( $sExtension, $resourceType )
$arAllowed = $Config['AllowedExtensions'][$resourceType] ;
$arDenied = $Config['DeniedExtensions'][$resourceType] ;
if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) )
if ( count((array)$arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) )
return false ;
if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) )
if ( count((array)$arDenied) > 0 && in_array( $sExtension, $arDenied ) )
return false ;
return true ;

View file

@ -92,7 +92,7 @@ function IsHtmlExtension( $ext, $htmlExtensions )
return false ;
}
$lcaseHtmlExtensions = array() ;
foreach ( $htmlExtensions as $key => $val )
foreach ((array)$htmlExtensions as $key => $val )
{
$lcaseHtmlExtensions[$key] = strtolower( $val ) ;
}
@ -137,7 +137,7 @@ function DetectHtml( $filePath )
$tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' ) ;
foreach( $tags as $tag )
foreach ((array)$tags as $tag)
{
if( false !== strpos( $chunk, $tag ) )
{