Skip to content

Commit 5696065

Browse files
committed
Fix deprecation of finfo_close() in PHP 8.5 by conditionally closing the resource.
1 parent f5a071b commit 5696065

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

framework/helpers/BaseFileHelper.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,11 @@ public static function getMimeType($file, $magicFile = null, $checkExtension = t
171171

172172
if ($info) {
173173
$result = finfo_file($info, $file);
174-
finfo_close($info);
174+
// @link https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_finfo_close
175+
// @link https://github.com/php/php-src/commit/ccb716dcadf60d989db48e4d2963e14d7dc63df3
176+
if (PHP_VERSION_ID < 80500) {
177+
finfo_close($info);
178+
}
175179

176180
if ($result !== false) {
177181
return $result;

0 commit comments

Comments
 (0)