Skip to content

Commit 6e31b09

Browse files
authored
Update main.php humanize_usage_size() (hestiacp#4015)
* Update main.php humanize_usage_size() Tweak humanize_usage_size() so that it doesn't die part way through with: 2023/09/21 14:18:16 [error] 353479#0: *56 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: number_format(): Argument hestiacp#1 ($num) must be of type float, string given in /usr/local/hestia/web/inc/main.php:368 Stack trace: #0 /usr/local/hestia/web/inc/main.php(368): number_format() hestiacp#1 /usr/local/hestia/web/templates/pages/list_user.php(246): humanize_usage_size() hestiacp#2 /usr/local/hestia/web/inc/main.php(202): include('...') hestiacp#3 /usr/local/hestia/web/list/user/index.php(33): render_page() hestiacp#4 {main} thrown in /usr/local/hestia/web/inc/main.php on line 368" while reading upstream, client: 81.174.134.33, server: _, request: "GET /list/user/ HTTP/2.0", upstream: "fastcgi://unix:/run/hestia-php.sock:", host: "brian2022.newbyhost.com:9183", referrer: "https://brian2022.newbyhost.com:9183/list/web/" For some reason some stats come back as null, which breaks this function
1 parent 3540e8a commit 6e31b09

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

web/inc/main.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ function humanize_usage_size($usage, $round = 2) {
352352
if ($usage == "unlimited") {
353353
return "";
354354
}
355+
if ($usage < 1) {
356+
$usage = "0";
357+
}
355358
$display_usage = $usage;
356359
if ($usage > 1024) {
357360
$usage = $usage / 1024;

0 commit comments

Comments
 (0)