summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/iputil.inc.php5
-rw-r--r--inc/util.inc.php6
-rw-r--r--install.php5
-rw-r--r--modules-available/dnbd3/inc/dnbd3util.inc.php13
-rw-r--r--modules-available/remoteaccess/api.inc.php3
5 files changed, 9 insertions, 23 deletions
diff --git a/inc/iputil.inc.php b/inc/iputil.inc.php
index caac7349..a50f22eb 100644
--- a/inc/iputil.inc.php
+++ b/inc/iputil.inc.php
@@ -58,9 +58,6 @@ class IpUtil
$ip = ip2long($cidr);
if ($ip === false)
return null;
- if (PHP_INT_SIZE === 4) {
- $ip = sprintf('%u', $ip);
- }
return ['start' => $ip, 'end' => $ip];
}
$ip = $parts[0];
@@ -75,8 +72,6 @@ class IpUtil
if ($ip === false)
return null;
$bits = (int)((2 ** (32 - $bits)) - 1);
- if (PHP_INT_SIZE === 4)
- return ['start' => sprintf('%u', $ip & ~$bits), 'end' => sprintf('%u', $ip | $bits)];
return ['start' => $ip & ~$bits, 'end' => $ip | $bits];
}
diff --git a/inc/util.inc.php b/inc/util.inc.php
index a5ccdc77..267a3971 100644
--- a/inc/util.inc.php
+++ b/inc/util.inc.php
@@ -103,11 +103,7 @@ class Util
public static function readableFileSize($bytes, int $decimals = -1, int $shift = 0): string
{
// round doesn't reliably work for large floats, pick workaround depending on OS
- if (PHP_INT_SIZE === 4) {
- $bytes = sprintf('%.0f', $bytes);
- } else {
- $bytes = sprintf('%u', $bytes);
- }
+ $bytes = sprintf('%u', $bytes);
static $sz = array('Byte', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB');
$factor = (int)floor((strlen($bytes) - 1) / 3);
if ($factor === 0) {
diff --git a/install.php b/install.php
index 530298b1..6cbbe91f 100644
--- a/install.php
+++ b/install.php
@@ -21,6 +21,11 @@
use JetBrains\PhpStorm\NoReturn;
+if (PHP_INT_SIZE < 8) {
+ echo "32bit platforms no longer supported\n";
+ exit(1);
+}
+
/**
* Report back the update status to the browser/client and terminate execution.
* This has to be called by an update module at some point to signal the result
diff --git a/modules-available/dnbd3/inc/dnbd3util.inc.php b/modules-available/dnbd3/inc/dnbd3util.inc.php
index 47d7a4ea..7d95147a 100644
--- a/modules-available/dnbd3/inc/dnbd3util.inc.php
+++ b/modules-available/dnbd3/inc/dnbd3util.inc.php
@@ -136,13 +136,10 @@ class Dnbd3Util {
array('locs' => array_values($recursiveLocs)));
// Coalesce overlapping ranges
$floatIp = ip2long($self); // Float for 32bit php :/
- if (PHP_INT_SIZE === 4) {
- $floatIp = (float)sprintf('%u', $floatIp); // Float for 32bit php :/
- }
$ranges = [['startaddr' => $floatIp, 'endaddr' => $floatIp]];
foreach ($res as $row) {
- settype($row['startaddr'], PHP_INT_SIZE === 4 ? 'float' : 'int');
- settype($row['endaddr'], PHP_INT_SIZE === 4 ? 'float' : 'int');
+ settype($row['startaddr'], 'int');
+ settype($row['endaddr'], 'int');
self::mergeRanges($ranges, $row);
}
// Got subnets, build whitelist
@@ -215,11 +212,7 @@ class Dnbd3Util {
*/
private static function range2Cidr(int $start, int $end): string
{
- if (PHP_INT_SIZE > 4) {
- $bin = decbin($start ^ $end);
- } else {
- $bin = decbin((int)(float)$start ^ (int)(float)$end);
- }
+ $bin = decbin($start ^ $end);
if ($bin === '0')
return long2ip($start);
$mask = 32 - strlen($bin);
diff --git a/modules-available/remoteaccess/api.inc.php b/modules-available/remoteaccess/api.inc.php
index ca04eec4..c558d126 100644
--- a/modules-available/remoteaccess/api.inc.php
+++ b/modules-available/remoteaccess/api.inc.php
@@ -25,9 +25,6 @@ if ($range === null) {
die('No allowed IP defined');
}
$iplong = ip2long($ip);
-if (PHP_INT_SIZE === 4) {
- $iplong = sprintf('%u', $iplong);
-}
if ($iplong < $range['start'] || $iplong > $range['end']) {
die('Access denied');
}