WebsiteBaker Support (2.13.x) > General Help & Support
Droplets in 2.13.0 r63 unter PHP 8 - Problem!
Luisehahne:
Patch R115 is under preparation, we will inform you
Dietmar
crnogorac081:
Ok. Is there a quickfix for this line in IpAddress.php ?
Luisehahne:
--- Quote from: crnogorac081 on May 02, 2022, 12:20:03 PM ---Ok. Is there a quickfix for this line in IpAddress.php ?
--- End quote ---
Fixed methode in /framework/Utils/IpAddress.php
--- Code: ---<?php
public static function sanitizeIp(string $sRawIp): string
{
// clean address from netmask/prefix and port
$sPattern = '/^[{\[]?([.:a-f0-9]*)(?:\/[0-1]*)?(?:[\]}]?.*)$/im';
$sIpAddress = \preg_replace($sPattern, '$1', $sRawIp);
if (\strpos($sIpAddress, ':') === false) {
// sanitize IPv4 -------------------------------------------------------------- //
if (ip2long($sIpAddress) === false) {
throw new \InvalidArgumentException('illegal IPv4 address given!');
}
} else {
// sanitize IPv6 -------------------------------------------------------------- //
// for backard compatibility it also check deprecated addressing where
// IP includes a 32 bit IPv4 part and convert this into IPv6 format
// sanitize IPv6 -------------------------------------------------------------- //
$sPattern = '/^([:a-f0-9]*?)(?:(?:\:)([0-9]{1,3}(?:\.[0-9]{1,3}){3}))?$/is';
$aMatches = [];
if (\preg_match($sPattern, $sIpAddress, $aMatches)) {
$sIpAddress = $aMatches[1].(isset($aMatches[2]) ? ':'.self::convertV4ToV6($aMatches[2]) : '');
} else {
throw new \InvalidArgumentException('illegal IPv6 address given!');
}
$sIpAddress = self::expandIpV6($sIpAddress);
}
return $sIpAddress;
}
--- End code ---
Dietmar
hgs:
Hallo Dietmar
Der TeilCode, den du gepostet hast, ist laut "Diff Ceck" identisch mit dem TeilCode aus patch 114 in der besagten Datei.
Heißt das, dass Patch 114 das Problem fixen würde?
crnogorac081:
I kind of solver it,
line 107
--- Code: --- public static function expandIpV6(string $sIpV6Address): string
{
$iPos = strpos($sIpV6Address, '::');
if ($iPos !== false) {
// $iInserts = 8 - \count(\preg_split('/:/', $sIpV6Address, null, \PREG_SPLIT_NO_EMPTY));
// Replaced null with -1
$iInserts = 8 - \count(\preg_split('/:/', $sIpV6Address, -1, \PREG_SPLIT_NO_EMPTY));
--- End code ---
I dont know if it is correct or not for further code I just saw preg_split documentation.
cheers
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version