aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Minz/Migrator.php2
-rw-r--r--lib/lib_rss.php4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/Minz/Migrator.php b/lib/Minz/Migrator.php
index 47df98e7f..c7e8ea15d 100644
--- a/lib/Minz/Migrator.php
+++ b/lib/Minz/Migrator.php
@@ -33,7 +33,7 @@ class Minz_Migrator
if ($applied_migrations === false) {
return "Cannot open the {$applied_migrations_path} file";
}
- $applied_migrations = array_filter(explode("\n", $applied_migrations));
+ $applied_migrations = array_filter(explode("\n", $applied_migrations), fn(string $migration): bool => trim($migration) !== '');
$migration_files = scandir($migrations_path) ?: [];
$migration_files = array_filter($migration_files, static function (string $filename) {
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index 8954f9921..480152400 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -231,8 +231,8 @@ function format_bytes(int $bytes, int $precision = 2, string $system = 'IEC'): s
return format_number($bytes, $precision);
}
$bytes = max(intval($bytes), 0);
- $pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base));
- $pow = min($pow, count($units) - 1);
+ $pow = $bytes === 0 ? 0 : (int)floor(log($bytes) / log($base));
+ $pow = min(max(0, $pow), count($units) - 1);
$bytes /= pow($base, $pow);
return format_number($bytes, $precision) . ' ' . $units[$pow];
}