aboutsummaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorshevabam <shevabam@gmail.com>2017-11-02 20:54:43 +0100
committershevabam <shevabam@gmail.com>2017-11-02 20:54:43 +0100
commit725787bcf7421143d6567e5b4f39ab5fd3fd8695 (patch)
tree350af5d92c101bd697b9bb0b165f172915a3742a /libs
parentf6dc27183987b65dc06c11dbfd21507da15f1ea7 (diff)
fix PHP 7.1 notices "non well formed numeric value" #52
Diffstat (limited to 'libs')
-rw-r--r--libs/load_average.php2
-rw-r--r--libs/memory.php1
-rw-r--r--libs/swap.php2
-rw-r--r--libs/system.php2
4 files changed, 5 insertions, 2 deletions
diff --git a/libs/load_average.php b/libs/load_average.php
index 09a2f3c..a48cc1d 100644
--- a/libs/load_average.php
+++ b/libs/load_average.php
@@ -14,7 +14,7 @@ else
$load = array_map(
function ($value, $cores) {
- $v = (int)($value * 100 / $cores);
+ $v = (int)((float)$value * 100 / $cores);
if ($v > 100)
$v = 100;
return $v;
diff --git a/libs/memory.php b/libs/memory.php
index a4eda7b..d7ed89f 100644
--- a/libs/memory.php
+++ b/libs/memory.php
@@ -17,6 +17,7 @@ if (!($total = shell_exec('grep MemTotal /proc/meminfo | awk \'{print $2}\'')))
{
$total = 0;
}
+$total = (int)$total;
// Used
$used = $total - $free;
diff --git a/libs/swap.php b/libs/swap.php
index e3cc980..42fbf8d 100644
--- a/libs/swap.php
+++ b/libs/swap.php
@@ -6,12 +6,14 @@ if (!($free = shell_exec('grep SwapFree /proc/meminfo | awk \'{print $2}\'')))
{
$free = 0;
}
+$free = (int)$free;
// Total
if (!($total = shell_exec('grep SwapTotal /proc/meminfo | awk \'{print $2}\'')))
{
$total = 0;
}
+$total = (int)$total;
// Used
$used = $total - $free;
diff --git a/libs/system.php b/libs/system.php
index ee43722..b6341f6 100644
--- a/libs/system.php
+++ b/libs/system.php
@@ -35,7 +35,7 @@ if (!($totalSeconds = shell_exec('/usr/bin/cut -d. -f1 /proc/uptime')))
}
else
{
- $uptime = Misc::getHumanTime($totalSeconds);
+ $uptime = Misc::getHumanTime((int)$totalSeconds);
}
// Last boot