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

@ -56,11 +56,11 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
$i = 0; // number of catches
foreach ($bits as $bit) {
foreach ((array)$bits as $bit) {
if ($bit === '') {
continue;
}
foreach ($caught as $key => $status) {
foreach ((array)$caught as $key => $status) {
if ($key != 'position') {
if ($status !== false) {
continue;
@ -94,7 +94,7 @@ class HTMLPurifier_AttrDef_CSS_Background extends HTMLPurifier_AttrDef
}
$ret = array();
foreach ($caught as $value) {
foreach ((array)$caught as $value) {
if ($value === false) {
continue;
}

View file

@ -88,7 +88,7 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
'center' => 'c'
);
foreach ($bits as $bit) {
foreach ((array)$bits as $bit) {
if ($bit === '') {
continue;
}
@ -135,7 +135,7 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
} elseif ($keywords['ch']) {
$ret[] = $keywords['ch'];
$keywords['cv'] = false; // prevent re-use: center = center center
} elseif (count($measures)) {
} elseif (count((array)$measures)) {
$ret[] = array_shift($measures);
}
@ -143,7 +143,7 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
$ret[] = $keywords['v'];
} elseif ($keywords['cv']) {
$ret[] = $keywords['cv'];
} elseif (count($measures)) {
} elseif (count((array)$measures)) {
$ret[] = array_shift($measures);
}

View file

@ -36,7 +36,7 @@ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
$bits = explode(' ', $string);
$done = array(); // segments we've finished
$ret = ''; // return value
foreach ($bits as $bit) {
foreach ((array)$bits as $bit) {
foreach ($this->info as $propname => $validator) {
if (isset($done[$propname])) {
continue;

View file

@ -78,7 +78,7 @@ class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
$values = trim(str_replace($function, '', $color), ' ()');
$parts = explode(',', $values);
if (count($parts) !== $parameters_size) {
if (count((array)$parts) !== $parameters_size) {
return false;
}
@ -86,7 +86,7 @@ class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
$new_parts = array();
$i = 0;
foreach ($parts as $part) {
foreach ((array)$parts as $part) {
$i++;
$part = trim($part);
@ -95,7 +95,7 @@ class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
}
// different check for alpha channel
if ($alpha_channel === true && $i === count($parts)) {
if ($alpha_channel === true && $i === count((array)$parts)) {
$result = $this->alpha->validate($part, $config, $context);
if ($result === false) {
@ -112,7 +112,7 @@ class HTMLPurifier_AttrDef_CSS_Color extends HTMLPurifier_AttrDef
$current_type = 'integer';
}
if (!array_key_exists($current_type, $allowed_types[$i])) {
if (!array_key_exists($current_type, (array)$allowed_types[$i])) {
return false;
}

View file

@ -44,7 +44,7 @@ class HTMLPurifier_AttrDef_CSS_Filter extends HTMLPurifier_AttrDef
$params = explode(',', $parameters);
$ret_params = array();
$lookup = array();
foreach ($params as $param) {
foreach ((array)$params as $param) {
list($key, $value) = explode('=', $param);
$key = trim($key);
$value = trim($value);

View file

@ -65,13 +65,13 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
$stage_1 = array('font-style', 'font-variant', 'font-weight');
$final = ''; // output
for ($i = 0, $size = count($bits); $i < $size; $i++) {
for ($i = 0, $size = count((array)$bits); $i < $size; $i++) {
if ($bits[$i] === '') {
continue;
}
switch ($stage) {
case 0: // attempting to catch font-style, font-variant or font-weight
foreach ($stage_1 as $validator_name) {
foreach ((array)$stage_1 as $validator_name) {
if (isset($caught[$validator_name])) {
continue;
}
@ -87,7 +87,7 @@ class HTMLPurifier_AttrDef_CSS_Font extends HTMLPurifier_AttrDef
}
}
// all three caught, continue on
if (count($caught) >= 3) {
if (count((array)$caught) >= 3) {
$stage = 1;
}
if ($r !== false) {

View file

@ -66,7 +66,7 @@ class HTMLPurifier_AttrDef_CSS_FontFamily extends HTMLPurifier_AttrDef
// assume that no font names contain commas in them
$fonts = explode(',', $string);
$final = '';
foreach ($fonts as $font) {
foreach ((array)$fonts as $font) {
$font = trim($font);
if ($font === '') {
continue;

View file

@ -50,14 +50,14 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
$i = 0; // number of catches
$none = false;
foreach ($bits as $bit) {
foreach ((array)$bits as $bit) {
if ($i >= 3) {
return;
} // optimization bit
if ($bit === '') {
continue;
}
foreach ($caught as $key => $status) {
foreach ((array)$caught as $key => $status) {
if ($status !== false) {
continue;
}

View file

@ -49,7 +49,7 @@ class HTMLPurifier_AttrDef_CSS_Multiple extends HTMLPurifier_AttrDef
return false;
}
$parts = explode(' ', $string); // parseCDATA replaced \r, \t and \n
$length = count($parts);
$length = count((array)$parts);
$final = '';
for ($i = 0, $num = 0; $i < $length && $num < $this->max; $i++) {
if (ctype_space($parts[$i])) {

View file

@ -30,7 +30,7 @@ class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
$parts = explode(' ', $string);
$final = '';
foreach ($parts as $part) {
foreach ((array)$parts as $part) {
if (isset($allowed_values[$part])) {
$final .= $part . ' ';
}