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

@ -49,13 +49,13 @@ function smarty_core_create_dir_structure($params, &$smarty)
}
/* all paths use "/" only from here */
foreach ($_dir_parts as $_dir_part) {
foreach ((array)$_dir_parts as $_dir_part) {
$_new_dir .= $_dir_part;
if ($_use_open_basedir) {
// do not attempt to test or make directories outside of open_basedir
$_make_new_dir = false;
foreach ($_open_basedirs as $_open_basedir) {
foreach ((array)$_open_basedirs as $_open_basedir) {
if (substr($_new_dir, 0, strlen($_open_basedir)) == $_open_basedir) {
$_make_new_dir = true;
break;

View file

@ -30,7 +30,7 @@ function smarty_core_get_include_path(&$params, &$smarty)
$_path_array = explode(':',$_ini_include_path);
}
}
foreach ($_path_array as $_include_path) {
foreach ((array)$_path_array as $_include_path) {
if (@is_readable($_include_path . DIRECTORY_SEPARATOR . $params['file_path'])) {
$params['new_file_path'] = $_include_path . DIRECTORY_SEPARATOR . $params['file_path'];
return true;

View file

@ -16,7 +16,7 @@
function smarty_core_load_plugins($params, &$smarty)
{
foreach ($params['plugins'] as $_plugin_info) {
foreach ((array)$params['plugins'] as $_plugin_info) {
list($_type, $_name, $_tpl_file, $_tpl_line, $_delayed_loading) = $_plugin_info;
$_plugin = &$smarty->_plugins[$_type][$_name];

View file

@ -24,9 +24,9 @@ function smarty_core_load_resource_plugin($params, &$smarty)
$_plugin = &$smarty->_plugins['resource'][$params['type']];
if (isset($_plugin)) {
if (!$_plugin[1] && count($_plugin[0])) {
if (!$_plugin[1] && count((array)$_plugin[0])) {
$_plugin[1] = true;
foreach ($_plugin[0] as $_plugin_func) {
foreach ((array)$_plugin[0] as $_plugin_func) {
if (!is_callable($_plugin_func)) {
$_plugin[1] = false;
break;
@ -55,7 +55,7 @@ function smarty_core_load_resource_plugin($params, &$smarty)
*/
$_resource_ops = array('source', 'timestamp', 'secure', 'trusted');
$_resource_funcs = array();
foreach ($_resource_ops as $_op) {
foreach ((array)$_resource_ops as $_op) {
$_plugin_func = 'smarty_resource_' . $params['type'] . '_' . $_op;
if (!function_exists($_plugin_func)) {
$smarty->_trigger_fatal_error("[plugin] function $_plugin_func() not found in $_plugin_file", null, null, __FILE__, __LINE__);

View file

@ -17,7 +17,7 @@ function smarty_core_process_cached_inserts($params, &$smarty)
$params['results'], $match);
list($cached_inserts, $insert_args) = $match;
for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
for ($i = 0, $for_max = count((array)$cached_inserts); $i < $for_max; $i++) {
if ($smarty->debugging) {
$_params = array();
require_once(SMARTY_CORE_DIR . 'core.get_microtime.php');

View file

@ -38,12 +38,12 @@ function smarty_core_write_cache_file($params, &$smarty)
// this new nocache-tag will be replaced by dynamic contents in
// smarty_core_process_compiled_includes() on a cache-read
$match_count = count($match[0]);
$match_count = count((array)$match[0]);
$results = preg_split('!(\{/?nocache\:[0-9a-f]{32}#\d+\})!', $params['results'], -1, PREG_SPLIT_DELIM_CAPTURE);
$level = 0;
$j = 0;
for ($i=0, $results_count = count($results); $i < $results_count && $j < $match_count; $i++) {
for ($i=0, $results_count = count((array)$results); $i < $results_count && $j < $match_count; $i++) {
if ($results[$i] == $match[0][$j]) {
// nocache tag
if ($match[1][$j]) { // closing tag

View file

@ -22,7 +22,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
$params['compiled_content'], $_match_source, PREG_SET_ORDER);
// no nocache-parts found: done
if (count($_match_source)==0) return;
if (count((array)$_match_source)==0) return;
// convert the matched php-code to functions
$_include_compiled = "<?php /* Smarty version ".$smarty->_version.", created on ".strftime("%Y-%m-%d %H:%M:%S")."\n";
@ -37,7 +37,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
$_include_compiled .= "<?php";
$this_varname = ((double)phpversion() >= 5.0) ? '_smarty' : 'this';
for ($_i = 0, $_for_max = count($_match_source); $_i < $_for_max; $_i++) {
for ($_i = 0, $_for_max = count((array)$_match_source); $_i < $_for_max; $_i++) {
$_match =& $_match_source[$_i];
$source = $_match[4];
if ($this_varname == '_smarty') {
@ -56,7 +56,7 @@ function smarty_core_write_compiled_include($params, &$smarty)
if ($open_tag == '<?php ') break;
}
for ($i=0, $count = count($tokens); $i < $count; $i++) {
for ($i=0, $count = count((array)$tokens); $i < $count; $i++) {
if (is_array($tokens[$i])) {
if ($tokens[$i][0] == T_VARIABLE && $tokens[$i][1] == '$this') {
$tokens[$i] = '$' . $this_varname;