Skip to content

Commit

Permalink
Do not cast hard drive size to integer - fixes #1037
Browse files Browse the repository at this point in the history
  • Loading branch information
socram8888 authored and shish committed Feb 17, 2024
1 parent b3eb5e7 commit 08b0150
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/polyfills.php
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ function parse_shorthand_int(string $limit): int
/**
* Turn an integer into a human readable filesize, eg 1024 -> 1KB
*/
function to_shorthand_int(int $int): string
function to_shorthand_int(int|float $int): string
{
assert($int >= 0);

Expand Down
6 changes: 4 additions & 2 deletions ext/et/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ private function get_info(): array
$ver .= "+";
}

$disk_total = false_throws(disk_total_space("./"));
$disk_free = false_throws(disk_free_space("./"));
$info = [
"about" => [
'title' => $config->get_string(SetupConfig::TITLE),
Expand All @@ -103,8 +105,8 @@ private function get_info(): array
],
"media" => [
"memory_limit" => to_shorthand_int($config->get_int(MediaConfig::MEM_LIMIT)),
"disk_use" => to_shorthand_int((int)disk_total_space("./") - (int)disk_free_space("./")),
"disk_total" => to_shorthand_int((int)disk_total_space("./")),
"disk_use" => to_shorthand_int($disk_total - $disk_free),
"disk_total" => to_shorthand_int($disk_total),
],
"thumbnails" => [
"engine" => $config->get_string(ImageConfig::THUMB_ENGINE),
Expand Down

0 comments on commit 08b0150

Please sign in to comment.