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

@ -54,7 +54,7 @@ function exec_ogp_module()
$ftp_accounts_list = $remote->ftp_mgr("list");
$ftp_accounts = explode("\n",$ftp_accounts_list);
$user_exists = FALSE;
foreach($ftp_accounts as $ftp_account)
foreach ((array)$ftp_accounts as $ftp_account)
{
if( $ftp_account != "" )
{
@ -97,7 +97,7 @@ function exec_ogp_module()
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
$ftp_login = strip_real_escape_string($_POST['ftp_login']);
$settings = "";
foreach($_POST as $key => $value)
foreach ((array)$_POST as $key => $value)
{
if ($key != "edit_ftp_user" and $key != "ftp_login" and $key != "remote_server_id")
{
@ -118,7 +118,7 @@ function exec_ogp_module()
<table class='center' style='width:100%' ><tr>
<td>". get_lang("remote_server") ." <select style='width:250px' name='remote_server_id' >";
foreach ( $servers as $server_row )
foreach ((array)$servers as $server_row)
{
$display_ip = checkDisplayPublicIP($server_row['display_public_ip'],$server_row['agent_ip']);
echo "<option value='" . $server_row['remote_server_id'] . "' >" . $server_row['remote_server_name'] . " (" . $display_ip . ":" . $server_row['agent_port'] . ")</option>";
@ -144,7 +144,7 @@ function exec_ogp_module()
</thead>
<tbody>
<?php
foreach ( $servers as $server_row )
foreach ((array)$servers as $server_row)
{
$display_ip = checkDisplayPublicIP($server_row['display_public_ip'],$server_row['agent_ip']);
$remote = new OGPRemoteLibrary($server_row['agent_ip'],$server_row['agent_port'],$server_row['encryption_key'],$server_row['timeout']);
@ -157,7 +157,7 @@ function exec_ogp_module()
{
$ftp_accounts_list = $remote->ftp_mgr("list");
$ftp_accounts = explode("\n", $ftp_accounts_list);
foreach($ftp_accounts as $ftp_account)
foreach ((array)$ftp_accounts as $ftp_account)
{
if( !empty($ftp_account))
{
@ -175,7 +175,7 @@ function exec_ogp_module()
$ftp_account_detail_list = explode("\n",$account_details);
foreach($ftp_account_detail_list as $detail_line)
foreach ((array)$ftp_account_detail_list as $detail_line)
{
if( !empty($detail_line))
{
@ -193,7 +193,7 @@ function exec_ogp_module()
$value_parts = explode(" ", $value);
if(is_numeric($value_parts[0]))
{
if(count($value_parts) > 1)
if(count((array)$value_parts) > 1)
{
$value = array_shift($value_parts);
$advert = implode(" ", $value_parts);
@ -210,7 +210,7 @@ function exec_ogp_module()
}
}
}
if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count($ftp_account_detail_list) == 4 and $key == "Directory" ) )
if ($key == "Allowed local IPs" or $key == "ul_ratio" or $key == "ForceSsl" or ( count((array)$ftp_account_detail_list) == 4 and $key == "Directory" ) )
echo "</table>\n</td><td>\n<table>\n";
if ($key == "Directory" )
$value = str_replace( "/./", "", $value );

View file

@ -3006,7 +3006,7 @@ function htmlEncode2($string) {
// --------------
// This function HTML-encodes a string with *htmlspecialchars* to print it on a page.
// Only some special characters are encoded, otherwise special characters (e.g. é) appear encoded (&eacute).
// Only some special characters are encoded, otherwise special characters (e.g. ) appear encoded (&eacute).
// --------------
$isocode = __("iso-8859-1");
@ -3377,7 +3377,7 @@ $AttmFiles ... array containing the filenames to attach like array("file1","file
// Attachments
if($AttmFiles){
foreach($AttmFiles as $AttmFile){
foreach ((array)$AttmFiles as $AttmFile){
// $patharray = explode ("/", $AttmFile);
// $FileName=$patharray[sizeof($patharray)-1];
$FileName = "RequestedFile.zip";

View file

@ -13,7 +13,7 @@
// gzip tools and WinZip application.
//
// Description :
// See readme.txt (English & Français) and http://www.phpconcept.net
// See readme.txt (English & Franais) and http://www.phpconcept.net
//
// Warning :
// This library and the associated files are non commercial, non professional
@ -405,7 +405,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
// $p_filelist, in the directory
// $p_path. The relative path of the archived files are keep and become
// relative to $p_path.
// If a directory is spécified in the list, all the files from this directory
// If a directory is spcified in the list, all the files from this directory
// will be extracted.
// If a file with the same name already exists it will be replaced.
// If the path to the file does not exist, it will be created.
@ -1349,7 +1349,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
}
// ----- Loop on the files
for ($j=0; ($j<count($p_list)) && ($v_result==1); $j++)
for ($j=0; ($j<count((array)$p_list)) && ($v_result==1); $j++)
{
// ----- Recuperate the filename
$p_filename = $p_list[$j];
@ -2031,7 +2031,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
// ----- Look if the extracted file is older
else if (filemtime($v_header[filename]) > $v_header[mtime])
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])).")");
// ----- Change the file status
$v_header[status] = "newer_exist";
@ -2164,7 +2164,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
TrFctMessage(__FILE__, __LINE__, 4, "Position aprs jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
if ($p_tar_mode == "tar")
@ -2395,7 +2395,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
TrFctMessage(__FILE__, __LINE__, 4, "Position aprs jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
if ($p_tar_mode == "tar")
@ -2514,7 +2514,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
// ----- Look if the extracted file is older
else if (filemtime($v_header[filename]) > $v_header[mtime])
{
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", $v_header[mtime]).")");
TrFctMessage(__FILE__, __LINE__, 2, "Existing file '$v_header[filename]' is newer (".date("l dS of F Y h:i:s A", filemtime($v_header[filename])).") than the extracted file (".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])).")");
// ----- Change the file status
$v_header[status] = "newer_exist";
@ -2836,7 +2836,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
else
gzseek($v_tar, gztell($v_tar)+(ceil(($v_header[size]/512))*512));
TrFctMessage(__FILE__, __LINE__, 4, "Position après jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
TrFctMessage(__FILE__, __LINE__, 4, "Position aprs jump [".($p_tar_mode=="tar"?ftell($v_tar):gztell($v_tar))."]");
}
// ----- Look for end of file
@ -3058,7 +3058,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
{
TrFctMessage(__FILE__, __LINE__, 3, "File '$v_stored_list[$i]' is present in archive");
TrFctMessage(__FILE__, __LINE__, 3, "File '$v_stored_list[$i]' mtime=".filemtime($p_file_list[$i])." ".date("l dS of F Y h:i:s A", filemtime($p_file_list[$i])));
TrFctMessage(__FILE__, __LINE__, 3, "Archived mtime=".$v_header[mtime]." ".date("l dS of F Y h:i:s A", $v_header[mtime]));
TrFctMessage(__FILE__, __LINE__, 3, "Archived mtime=".$v_header[mtime]." ".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])));
// ----- Store found informations
$v_found_file = TRUE;
@ -3372,7 +3372,7 @@ $g_pcltar_extension = substr(strrchr(basename(__FILE__), '.'), 1);
$v_header[size] = OctDec(trim($v_data[size]));
TrFctMessage(__FILE__, __LINE__, 2, "Size : '$v_header[size]'");
$v_header[mtime] = OctDec(trim($v_data[mtime]));
TrFctMessage(__FILE__, __LINE__, 2, "Date : ".date("l dS of F Y h:i:s A", $v_header[mtime]));
TrFctMessage(__FILE__, __LINE__, 2, "Date : ".date("l dS of F Y h:i:s A", is_numeric($v_header[mtime]) ? (int)$v_header[mtime] : strtotime($v_header[mtime])));
if (($v_header[typeflag] = $v_data[typeflag]) == "5")
{
$v_header[size] = 0;

View file

@ -371,7 +371,7 @@
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
foreach ((array)$v_string_list as $v_string) {
if ($v_string != '') {
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
@ -389,7 +389,7 @@
,PCLZIP_ATT_FILE_CONTENT => 'optional'
,PCLZIP_ATT_FILE_COMMENT => 'optional'
);
foreach ($v_att_list as $v_entry) {
foreach ((array)$v_att_list as $v_entry) {
$v_result = $this->privFileDescrParseAtt($v_entry,
$v_filedescr_list[],
$v_options,
@ -558,7 +558,7 @@
// ----- Reformat the string list
if (sizeof($v_string_list) != 0) {
foreach ($v_string_list as $v_string) {
foreach ((array)$v_string_list as $v_string) {
$v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string;
}
}
@ -572,7 +572,7 @@
,PCLZIP_ATT_FILE_CONTENT => 'optional'
,PCLZIP_ATT_FILE_COMMENT => 'optional'
);
foreach ($v_att_list as $v_entry) {
foreach ((array)$v_att_list as $v_entry) {
$v_result = $this->privFileDescrParseAtt($v_entry,
$v_filedescr_list[],
$v_options,
@ -1872,7 +1872,7 @@
$v_result=1;
// ----- For each file in the list check the attributes
foreach ($p_file_list as $v_key => $v_value) {
foreach ((array)$p_file_list as $v_key => $v_value) {
// ----- Check if the option is supported
if (!isset($v_requested_options[$v_key])) {

View file

@ -156,7 +156,7 @@ function includeLanguageFile() {
$languageArray = getLanguageArray();
// If language exists, include the language file
if (array_key_exists($net2ftp_globals["language"], $languageArray) == true) {
if (array_key_exists($net2ftp_globals["language"], (array)$languageArray) == true) {
$languageFile = glueDirectories($net2ftp_globals["application_languagesdir"], $languageArray[$net2ftp_globals["language"]]["file"]);
require_once($languageFile);
}
@ -217,7 +217,7 @@ function __() {
// -------------------------------------------------------------------------
// Check if the message with that $messagename exists
if (@array_key_exists($messagename, $net2ftp_messages)) { $string_with_percents = $net2ftp_messages[$messagename]; }
if (@array_key_exists($messagename, (array)$net2ftp_messages)) { $string_with_percents = $net2ftp_messages[$messagename]; }
else { return "MESSAGE NOT FOUND $messagename"; }
$sprintf_argument = "\$translated_string = sprintf(\$string_with_percents";

View file

@ -168,7 +168,7 @@ function net2ftp_module_printBody() {
$file_index = 1;
$symlink_index = 1;
for ($i=1; $i<=count($list["all"]); $i++) {
for ($i=1; $i<=count((array)$list["all"]); $i++) {
if ($list["all"][$i]["dirorfile"] == "d") { $list["all"][$i]["message"] = __("Set the permissions of directory <b>%1\$s</b> to: ", $list["all"][$i]["dirfilename"]) . "<br />\n"; }
elseif ($list["all"][$i]["dirorfile"] == "-") { $list["all"][$i]["message"] = __("Set the permissions of file <b>%1\$s</b> to: ", $list["all"][$i]["dirfilename"]) . "<br />\n"; }
@ -219,7 +219,7 @@ function net2ftp_module_printBody() {
$symlink_index = 1;
// Calculate the chmod octal
for ($i=1; $i<=count($list["all"]); $i++) {
for ($i=1; $i<=count((array)$list["all"]); $i++) {
if (isset($list["all"][$i]["owner_read"]) == false) { $list["all"][$i]["owner_read"] = 0; }
if (isset($list["all"][$i]["owner_write"]) == false) { $list["all"][$i]["owner_write"] = 0; }
if (isset($list["all"][$i]["owner_execute"]) == false) { $list["all"][$i]["owner_execute"] = 0; }

View file

@ -523,7 +523,7 @@ function printEncodingSelect($text_encoding) {
$textarea_encodings = getTextareaEncodingsArray();
echo "<select name=\"encodingSelect\" id=\"encodingSelect\" style=\"width: 100px;\">\n";
foreach($textarea_encodings as $value) {
foreach ((array)$textarea_encodings as $value) {
if(strcasecmp($value, $text_encoding) == 0) { $selected = "selected=\"selected\""; }
else { $selected = ""; }
echo "<option value=\"$value\" $selected>$value</option>\n";

View file

@ -36,7 +36,7 @@ function net2ftp_module_sendHttpHeaders() {
// Code for old file jupload applet (jupload version 0.86)
// $file_counter = 0;
// foreach($_FILES as $tagname=>$object) {
// foreach ((array)$_FILES as $tagname=>$object) {
// if ($object['name'] != "") {
// $file_counter = $file_counter + 1;
// $uploadedFilesArray["$file_counter"]["name"] = $object['name'];
@ -55,7 +55,7 @@ function net2ftp_module_sendHttpHeaders() {
// Code for new file jupload applet (jupload version 5.0.8)
$file_counter = 0;
foreach($_FILES as $tagname=>$object) {
foreach ((array)$_FILES as $tagname=>$object) {
if ($object['name'] != "") {
$file_counter = $file_counter + 1;
$uploadedFilesArray["$file_counter"]["name"] = $object['name'];

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 ) )
{

View file

@ -455,7 +455,7 @@ class GeSHi {
'{LANGUAGE}' => $this->language,
'{PATH}' => $this->language_path
);
foreach ($debug_tpl_vars as $tpl => $var) {
foreach ((array)$debug_tpl_vars as $tpl => $var) {
$msg = str_replace($tpl, $var, $msg);
}
return "<br /><strong>GeSHi Error:</strong> $msg (code $this->error)<br />";
@ -1077,7 +1077,7 @@ class GeSHi {
$flag = $flag ? true : false;
foreach ($this->lexic_permissions as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
foreach ((array)$value as $k => $v) {
$this->lexic_permissions[$key][$k] = $flag;
}
}
@ -1101,7 +1101,7 @@ class GeSHi {
* @todo static?
*/
function get_language_name_from_extension( $extension, $lookup = array() ) {
if ( !is_array($lookup) || !count($lookup)) {
if ( !is_array($lookup) || !count((array)$lookup)) {
$lookup = array(
'actionscript' => array('as'),
'ada' => array('a', 'ada', 'adb', 'ads'),
@ -1143,8 +1143,8 @@ class GeSHi {
);
}
foreach ($lookup as $lang => $extensions) {
foreach ($extensions as $ext) {
foreach ((array)$lookup as $lang => $extensions) {
foreach ((array)$extensions as $ext) {
if ($ext == $extension) {
return $lang;
}
@ -1369,7 +1369,7 @@ class GeSHi {
*/
function highlight_lines_extra($lines, $style = null) {
if (is_array($lines)) {
foreach ($lines as $line) {
foreach ((array)$lines as $line) {
$this->highlight_lines_extra(line, $style);
}
}
@ -1508,7 +1508,7 @@ class GeSHi {
$char = substr($code, $i, 1);
if (!$HIGHLIGHTING_ON) {
foreach ($this->language_data['SCRIPT_DELIMITERS'] as $key => $delimiters) {
foreach ($delimiters as $open => $close) {
foreach ((array)$delimiters as $open => $close) {
// Get the next little bit for this opening string
$check = substr($code, $i, strlen($open));
// If it matches...
@ -1528,7 +1528,7 @@ class GeSHi {
}
else {
foreach ($this->language_data['SCRIPT_DELIMITERS'] as $key => $delimiters) {
foreach ($delimiters as $open => $close) {
foreach ((array)$delimiters as $open => $close) {
if ($open == $HIGHLIGHTING_ON) {
// Found the closing tag
break(2);
@ -1564,14 +1564,14 @@ class GeSHi {
// Now we go through each part. We know that even-indexed parts are
// code that shouldn't be highlighted, and odd-indexed parts should
// be highlighted
foreach ($parts as $key => $data) {
foreach ((array)$parts as $key => $data) {
$part = $data[1];
// If this block should be highlighted...
if ($key % 2) {
if ($this->strict_mode) {
// Find the class key for this block of code
foreach ($this->language_data['SCRIPT_DELIMITERS'] as $script_key => $script_data) {
foreach ($script_data as $open => $close) {
foreach ((array)$script_data as $open => $close) {
if ($data[0] == $open) {
break(2);
}
@ -1951,7 +1951,7 @@ class GeSHi {
if (false !== strpos($result, "\t")) {
$lines = explode("\n", $result);
$tab_width = $this->get_real_tab_width();
foreach ($lines as $key => $line) {
foreach ((array)$lines as $key => $line) {
if (false === strpos($line, "\t")) {
$lines[$key] = $line;
continue;
@ -2160,7 +2160,7 @@ class GeSHi {
if (preg_match('#[a-zA-Z]{2,}#', $stuff_to_parse)) {
foreach ($this->language_data['KEYWORDS'] as $k => $keywordset) {
if ($this->lexic_permissions['KEYWORDS'][$k]) {
foreach ($keywordset as $keyword) {
foreach ((array)$keywordset as $keyword) {
$keyword = preg_quote($keyword, '/');
//
// This replacement checks the word is on it's own (except if brackets etc
@ -2280,7 +2280,7 @@ class GeSHi {
$symbol_data = $symbol_preg = array();
foreach($this->language_data['SYMBOLS'] as $key => $symbols) {
if(is_array($symbols)) {
foreach($symbols as $sym) {
foreach ((array)$symbols as $sym) {
if(!isset($symbol_data[$sym])) {
$symbol_data[GeSHi::hsc($sym)] = $key;
$symbol_preg[] = preg_quote(GeSHi::hsc($sym), '/');
@ -2302,8 +2302,8 @@ class GeSHi {
preg_match_all("/(?:" . $sym_search . ")+/", $stuff_to_parse, $matches_in_stuff, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
//Match anything that is a highlighted block ...
preg_match_all("/<\|(?:<DOT>|[^>])+>(?:(?!\|>).*?)\|>|<\/a>/", $stuff_to_parse, $highlighted_in_stuff, PREG_OFFSET_CAPTURE);
foreach($matches_in_stuff as $stuff_match_id => $stuff_match_data) {
foreach($highlighted_in_stuff[0] as $highlight_id => $highlight_data) {
foreach ((array)$matches_in_stuff as $stuff_match_id => $stuff_match_data) {
foreach ((array)$highlighted_in_stuff[0] as $highlight_id => $highlight_data) {
//Do a range check of the found highlight identifier and the OOP match ...
if(($highlight_data[1] <= $stuff_match_data[0][1]) &&
($highlight_data[1] + strlen($highlight_data[0]) >= $stuff_match_data[0][1] + strlen($stuff_match_data[0][0])))
@ -2316,17 +2316,17 @@ class GeSHi {
}
//Rebuild the matches array to be ordered by offset ...
$symbol_offsets = array();
foreach($matches_in_stuff as $stuff_match_data) {
foreach ((array)$matches_in_stuff as $stuff_match_data) {
$symbol_offsets[$stuff_match_data[0][1]] = $stuff_match_data[0][0];
}
krsort($symbol_offsets);
//Perform the actual replacements ...
foreach($symbol_offsets as $symbol_offset => $symbol_match) {
foreach ((array)$symbol_offsets as $symbol_offset => $symbol_match) {
$symbol_hl = "";
$old_sym = -1;
//Split the current stuff to replace into its atomic symbols ...
preg_match_all("/$sym_search/", $symbol_match, $sym_match_syms, PREG_PATTERN_ORDER);
foreach($sym_match_syms[0] as $sym_ms) {
foreach ((array)$sym_match_syms[0] as $sym_ms) {
//Check if consequtive symbols belong to the same group to save output ...
if (isset($symbol_data[$sym_ms]) && ($symbol_data[$sym_ms] != $old_sym)) {
if(-1 != $old_sym) {
@ -2510,7 +2510,7 @@ class GeSHi {
$i = 0;
// Foreach line...
foreach ($code as $line) {
foreach ((array)$code as $line) {
//Reset the attributes for a new line ...
$attrs = array();
@ -2574,7 +2574,7 @@ class GeSHi {
// Add in the line surrounded by appropriate list HTML
$attr_string = '';
foreach ($attrs as $key => $attr) {
foreach ((array)$attrs as $key => $attr) {
$attr_string .= ' ' . $key . '="' . implode(' ', $attr) . '"';
}
$parsed_code .= "<li$attr_string>$start$line$end</li>$ls";
@ -2586,7 +2586,7 @@ class GeSHi {
$code = explode("\n", $parsed_code);
$parsed_code = '';
$i = 0;
foreach ($code as $line) {
foreach ((array)$code as $line) {
// Make lines have at least one space in them if they're empty
// BenBE: Checking emptiness using trim instead of relying on blanks
if ('' == trim($line)) {

View file

@ -146,7 +146,7 @@ class LuminousBashScanner extends LuminousScanner {
$this->record($m[2], 'VARIABLE');
}
elseif (($this->interpolated && count($stack) === 1 &&
elseif (($this->interpolated && count((array)$stack) === 1 &&
$this->scan('/(?<=\s|^)\#.*?(?=[)]|$)/m'))
|| $this->scan('/(?<=\s|^)\#.*/')) {
$this->record($this->match(), 'COMMENT');

View file

@ -121,7 +121,7 @@ class LuminousDiffScanner extends LuminousScanner {
$verbatim_ = '';
$types = array();
$prefixes = array();
foreach($lines as $l) {
foreach ((array)$lines as $l) {
if (!strlen($l) || $l[0] === ' ')
$types[]= 'DIFF_UNCHANGED';
elseif ($l[0] === '+' || $l[0] === '>')
@ -146,8 +146,8 @@ class LuminousDiffScanner extends LuminousScanner {
$tagged = $verbatim;
}
$exp = explode("\n", $tagged);
assert(count($exp) === count($prefixes));
foreach($exp as $i=>$v) {
assert(count((array)$exp) === count((array)$prefixes));
foreach ((array)$exp as $i=>$v) {
$t = $types[$i];
// if the sub-scanner escaped the line, we also need to escape the
// prefix for consistency
@ -158,7 +158,7 @@ class LuminousDiffScanner extends LuminousScanner {
$text,
$t,
$escaped);
if ($i < count($exp)-1) $this->record("\n", null);
if ($i < count((array)$exp)-1) $this->record("\n", null);
}
if ($this->eol()) $this->record($this->get(), null);
continue;

View file

@ -57,7 +57,7 @@ class LuminousErlangScanner extends LuminousSimpleScanner {
static function oo_stream_filter($tokens) {
$c = count($tokens)-1;
$c = count((array)$tokens)-1;
for($i=0; $i<$c; $i++) {
if ($tokens[$i][1] === ':') {
if ($i > 0) {

View file

@ -136,7 +136,7 @@ class LuminousSASSParser {
function next_sequence($sequence, $ignore=array()) {
$i = $this->index+1;
$len = count($this->tokens);
$seq_len = count($sequence);
$seq_len = count((array)$sequence);
$seq = 0;
$seq_start = 0;
while ($i<$len) {

View file

@ -187,7 +187,7 @@ see --help for help
// user provided language
$scanners = luminous::scanners();
$valid_scanner = false;
foreach($scanners as $lang=>$codes) {
foreach ((array)$scanners as $lang=>$codes) {
if (in_array($this->options['lang'], $codes)) {
$valid_scanner = true;
break;

View file

@ -96,7 +96,7 @@ class LuminousFilters {
$start = "$lead<DOCTAG>$tag_char$tag</DOCTAG><DOCPROPERTY>";
$j = 0;
$c = count($l);
$c = count((array)$l);
for($i=0; $j<$len && $i<$c; $i++)
{
$s = $l[$i];
@ -268,7 +268,7 @@ class LuminousFilters {
* This is a stream filter.
*/
static function oo_stream_filter($tokens) {
$c = count($tokens);
$c = count((array)$tokens);
for($i=0; $i<$c; $i++) {
if ($tokens[$i][0] !== 'IDENT') continue;
if ($i > 0) {

View file

@ -473,7 +473,7 @@ class Scanner {
$matches = null;
$name = null;
$m;
foreach($patterns as $name_=>$p) {
foreach ((array)$patterns as $name_=>$p) {
$index = $this->ss->match($p, $this->index, $m);
if ($index === false) continue;
if ($next === -1 || $index < $next) {
@ -500,7 +500,7 @@ class Scanner {
function get_next($patterns) {
$next = -1;
$matches = null;
foreach($patterns as $p) {
foreach ((array)$patterns as $p) {
$m;
$index = $this->ss->match($p, $this->index, $m);
if ($index === false) continue;
@ -524,7 +524,7 @@ class Scanner {
function get_next_strpos($patterns) {
$next = -1;
$match = null;
foreach($patterns as $p) {
foreach ((array)$patterns as $p) {
$index = strpos($this->src, $p, $this->index);
if ($index === false) continue;
if ($next === -1 || $index < $next) {
@ -802,7 +802,7 @@ class LuminousScanner extends Scanner {
* @internal
*/
protected function rule_mapper_filter($tokens) {
foreach($tokens as &$t) {
foreach ((array)$tokens as &$t) {
if (array_key_exists($t[0], $this->rule_tag_map))
$t[0] = $this->rule_tag_map[$t[0]];
}
@ -884,7 +884,7 @@ class LuminousScanner extends Scanner {
*/
public function remove_filter($name) {
foreach($this->filters as $token=>$filters) {
foreach($filters as $k=>$f) {
foreach ((array)$filters as $k=>$f) {
if ($f[0] === $name) unset($this->filters[$token][$k]);
}
}
@ -1057,7 +1057,7 @@ class LuminousScanner extends Scanner {
*/
function add_identifier_mapping($name, $matches) {
$array = array();
foreach($matches as $m) {
foreach ((array)$matches as $m) {
if (!$this->case_sensitive) $m = strtolower($m);
$array[$m] = true;
}
@ -1825,7 +1825,7 @@ class LuminousStatefulScanner extends LuminousSimpleScanner {
*/
protected function collapse_token_tree($node) {
$text = '';
foreach($node['children'] as $c) {
foreach ((array)$node['children'] as $c) {
if (is_string($c)) $text .= LuminousUtils::escape_string($c);
else $text .= $this->collapse_token_tree($c);
}

View file

@ -71,7 +71,7 @@ class LuminousStringSearch
$r = $matches_[0][1];
// strip the offsets from the match_groups
foreach($matches_ as $i=>&$v)
foreach ((array)$matches_ as $i=>&$v)
$v = $v[0];
$this->cache[$search] = array($r, $matches_);

View file

@ -104,7 +104,7 @@ abstract class LuminousFormatter {
$num_lines = 1;
$num_open = 0;
foreach($line_split as $l) {
foreach ((array)$line_split as $l) {
$l0 = $l[0];
if ($l0 === '<') {

View file

@ -90,7 +90,7 @@ class LuminousHTMLTemplates {
$template = self::_strip_template_whitespace($template);
}
foreach($variables as $search => $replace) {
foreach ((array)$variables as $search => $replace) {
$template = str_replace("{" . $search . "}", $replace, $template);
}
return $template;
@ -138,7 +138,7 @@ class LuminousFormatterHTML extends LuminousFormatter {
private function lines_numberless($src) {
$lines = array();
$lines_original = explode("\n", $src);
foreach($lines_original as $line) {
foreach ((array)$lines_original as $line) {
$l = $line;
$num = $this->wrap_line($l, $this->wrap_length);
// strip the newline if we're going to join it. Seems the easiest way to
@ -212,7 +212,7 @@ class LuminousFormatterHTML extends LuminousFormatter {
preg_match_all("/<\/([^\s>]*).*?>/", $matches[0], $close_tags,
PREG_SET_ORDER);
if (count($open_tags) != count($close_tags))
if (count((array)$open_tags) != count((array)$close_tags))
return $matches[0];
if (isset($open_tags[0])
&& trim($open_tags[0][1]) !== trim($close_tags[0][1])

View file

@ -116,7 +116,7 @@ EOF;
if ($this->wrap_length > 0) {
$str = '';
foreach($lines as $i=>$l) {
foreach ((array)$lines as $i=>$l) {
$this->wrap_line($l, $this->wrap_length);
$str .= $l;
}
@ -132,7 +132,7 @@ EOF;
return "{\\\textbackslash}";
return "\\\" . $matches[0];');
foreach($str_ as $s_) {
foreach ((array)$str_ as $s_) {
if ($s_[0] === '<') {
$s_ = preg_replace('%</[^>]+>%', '}', $s_);
$s_ = preg_replace_callback('%<([^>]+)>%', $f1
@ -167,7 +167,7 @@ EOF;
// NOTE: p being a reference is probably going to necessitate a lot of
// copying to pass through all these preg_* and str* calls.
// consider rewriting.
foreach($pieces as $k=>&$p) {
foreach ((array)$pieces as $k=>&$p) {
if (preg_match('/^\\\lms/', $p))
$stack[] = "" . $p;
elseif(preg_match('/^(\\\\\\\\)*\}/', $p)) {
@ -178,7 +178,7 @@ EOF;
elseif(strpos($p, "\n") !== false) {
$before = "";
$after = "";
foreach($stack as $st_) {
foreach ((array)$stack as $st_) {
$before .= $st_;
$after .= '}';
}

View file

@ -162,7 +162,7 @@ class _Luminous {
throw new Exception('Luminous internal error: Settings is not an array');
}
$old_settings = clone $this->settings;
foreach($settings as $k=>$v) {
foreach ((array)$settings as $k=>$v) {
$this->settings->set($k, $v);
}
}
@ -551,7 +551,7 @@ abstract class luminous {
$info = array(
'lines' => $lines,
'num_lines' => count($lines),
'num_lines' => count((array)$lines),
'trimmed' => trim($src),
'shebang' => $shebang
);

View file

@ -194,7 +194,7 @@ class LuminousOptions {
if (!is_array($array)) {
$array = array($nameOrArray => $value);
}
foreach($array as $option => $value) {
foreach ((array)$array as $option => $value) {
// for backwards compatibility we need to do this here
$option = str_replace('-', '_', $option);
$this->__set($option, $value);

View file

@ -74,7 +74,7 @@ class LuminousScanners
);
if (!is_array($language_name))
$language_name = array($language_name);
foreach($language_name as $l) {
foreach ((array)$language_name as $l) {
$this->lookup_table[$l] = $insert;
if (!$dummy)
$this->AddDescription($lang_description, $l);
@ -94,7 +94,7 @@ class LuminousScanners
{
foreach($this->descriptions as &$d)
{
foreach($d as $k=>$l)
foreach ((array)$d as $k=>$l)
{
if($l === $language_name)
unset($d[$k]);
@ -112,7 +112,7 @@ class LuminousScanners
{
if (is_array($language_name))
{
foreach($language_name as $l)
foreach ((array)$language_name as $l)
{
unset($this->lookup_table[$l]);
$this->UnsetDescription($l);
@ -160,7 +160,7 @@ class LuminousScanners
if (!isset($this->resolved_dependencies[$language_name]))
{
$this->resolved_dependencies[$language_name] = true;
foreach($g['dependencies'] as $d)
foreach ((array)$g['dependencies'] as $d)
{
$this->GetScannerArray($d, $default);
}

View file

@ -241,16 +241,16 @@ class LuminousCSSParser {
$css_ = array();
// now cleanup the array, drop !important
foreach($css as $selector=>$rules) {
foreach ((array)$css as $selector=>$rules) {
$rules_ = array();
foreach($rules as $prop=>$value) {
foreach ((array)$rules as $prop=>$value) {
list($prop, $value) = self::format_property_value($prop, $value);
$rules_[$prop] = $value;
}
// now split selector by comma
$selectors = preg_split('/\s*,\s*/', $selector);
foreach($selectors as $s) {
foreach ((array)$selectors as $s) {
// drop .luminous from the selector
$s = preg_replace('/^\.luminous\s*/', '', $s);
// now we assume that if something is in the form .classname then
@ -329,7 +329,7 @@ class LuminousCSSParser {
$css = array();
// array of selectors => rules, where rules is an array itself of (property, value)
// note this is going to get @font-face wrong, but we don't care about that.
for($i=0; $i<count($tokens); $i++) {
for($i=0; $i<count((array)$tokens); $i++) {
list($tok, $content, ) = $tokens[$i];
if ($tok === 'COMMENT') continue;
if (!$block) {

View file

@ -61,7 +61,7 @@ function getActivePlugins() {
// -------------------------------------------------------------------------
// Plugins to activate depending on other variables
// -------------------------------------------------------------------------
if ($net2ftp_globals["state"] == "edit" && isset($textareaType) == true && $textareaType != "" && array_key_exists($textareaType, $pluginProperties) == true) {
if ($net2ftp_globals["state"] == "edit" && isset($textareaType) == true && $textareaType != "" && array_key_exists($textareaType, (array)$pluginProperties) == true) {
if ($pluginProperties[$textareaType]["use"] == "yes") { $activePlugins[$plugincounter] = $textareaType; $plugincounter++; }
}

View file

@ -81,7 +81,7 @@
<li>
<?php echo __("Getting the raw list of directories and files: "); ?><br />
<?php for($i=0; $i<count($parsedlist); $i++) {
<?php for($i=0; $i<count((array)$parsedlist); $i++) {
echo "<u>Line $i</u><br />\n";
print_r($parsedlist[$i]);
echo "<br />";

View file

@ -96,7 +96,7 @@
<li>
<?php echo __("Getting the raw list of directories and files: "); ?><br />
<?php for($i=0; $i<count($parsedlist); $i++) {
<?php for($i=0; $i<count((array)$parsedlist); $i++) {
echo "<u>Line $i</u><br />\n";
print_r($parsedlist[$i]);
echo "<br />";

View file

@ -4,7 +4,7 @@
<input type="hidden" name="entry" value="">
<?php /* ----- No results are found ----- */ ?>
<?php if (count($result) == 0) { ?>
<?php if (count((array)$result) == 0) { ?>
<?php for ($i=0; $i<sizeof($net2ftp_output["findstring"]); $i++) { ?>
<?php echo $net2ftp_output["findstring"][$i]; ?><br />
<?php } // end for

View file

@ -15,7 +15,7 @@
$home_id = $_GET['home_id'];
$user_homes = $_SESSION['user_homes'];
$isAdmin = $_SESSION['isAdmin'];
foreach($user_homes as $ftp_info)
foreach ((array)$user_homes as $ftp_info)
{
if($ftp_info['home_id'] == $home_id OR !$home_id)
{