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

@ -108,7 +108,7 @@ class HTMLPurifier_AttrDef_URI_Host extends HTMLPurifier_AttrDef
$parts = explode('.', $string);
try {
$new_parts = array();
foreach ($parts as $part) {
foreach ((array)$parts as $part) {
$encodable = false;
for ($i = 0, $c = strlen($part); $i < $c; $i++) {
if (ord($part[$i]) > 0x7a) {

View file

@ -48,7 +48,7 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
// compression check
$aIP = explode('::', $aIP);
$c = count($aIP);
$c = count((array)$aIP);
if ($c > 2) {
return false;
} elseif ($c == 2) {
@ -56,28 +56,28 @@ class HTMLPurifier_AttrDef_URI_IPv6 extends HTMLPurifier_AttrDef_URI_IPv4
$first = explode(':', $first);
$second = explode(':', $second);
if (count($first) + count($second) > 8) {
if (count((array)$first) + count((array)$second) > 8) {
return false;
}
while (count($first) < 8) {
while (count((array)$first) < 8) {
array_push($first, '0');
}
array_splice($first, 8 - count($second), 8, $second);
array_splice($first, 8 - count((array)$second), 8, $second);
$aIP = $first;
unset($first, $second);
} else {
$aIP = explode(':', $aIP[0]);
}
$c = count($aIP);
$c = count((array)$aIP);
if ($c != 8) {
return false;
}
// All the pieces should be 16-bit hex strings. Are they?
foreach ($aIP as $piece) {
foreach ((array)$aIP as $piece) {
if (!preg_match('#^[0-9a-fA-F]{4}$#s', sprintf('%04s', $piece))) {
return false;
}