Update finfo_close PHP version check to 8.1

Adjusted the conditional to only call finfo_close for PHP versions below 8.1, reflecting that finfo_close has no effect since PHP 8.1 instead of 8.0.
This commit is contained in:
Hani Rouatbi
2025-12-07 13:05:51 +01:00
parent e47cf056a0
commit 9a14d9079a
4 changed files with 8 additions and 7 deletions

View File

@@ -30,7 +30,7 @@ if (! $username)
is_array($plugin_run_result = Plugins::getInstance()->run('user_not_admin_admin_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook is_array($plugin_run_result = Plugins::getInstance()->run('user_not_admin_admin_page', get_defined_vars())) ? extract($plugin_run_result) : null; //run hook
redirect(PATH . 'ucp.php?go=login&return=' . urlencode(ADMIN_PATH . '?cp=' . $go_to)); redirect(PATH . 'ucp.php?go=login&return=' . urlencode(ADMIN_PATH . '?cp=' . $go_to));
} }
elseif(! user_can('enter_acp')) elseif (! user_can('enter_acp'))
{ {
$usrcp->logout_cp(); $usrcp->logout_cp();
redirect($config['siteurl']); redirect($config['siteurl']);

View File

@@ -67,7 +67,7 @@ error_reporting(defined('DEV_STAGE') ? E_ALL : E_ALL ^ E_NOTICE);
function kleeja_show_error($error_number, $error_string = '', $error_file = '', $error_line = '') function kleeja_show_error($error_number, $error_string = '', $error_file = '', $error_line = '')
{ {
// Check if error reporting is disabled (happens with @ operator) // Check if error reporting is disabled (happens with @ operator)
if (!(error_reporting() & $error_number)) if (! (error_reporting() & $error_number))
{ {
return false; return false;
} }

View File

@@ -226,9 +226,10 @@ function check_mime_type($given_file_mime, $file_ext, $file_path)
{ {
$f_info = finfo_open(FILEINFO_MIME_TYPE); $f_info = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($f_info, $file_path); $mime = finfo_file($f_info, $file_path);
// finfo_close() has no effect since PHP 8.0
// Only call it for PHP < 8.0 where it actually closes the resource // finfo_close() has no effect since PHP 8.1
if (PHP_VERSION_ID < 80000) // Only call it for PHP < 8.1 where it actually closes the resource
if (PHP_VERSION_ID < 80100)
{ {
finfo_close($f_info); finfo_close($f_info);
} }

View File

@@ -344,13 +344,13 @@ switch (g('go'))
$your_fileuser = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $usrcp->id() . '.html' : 'ucp.php?go=fileuser&amp;id=' . $usrcp->id()); $your_fileuser = $config['siteurl'] . ($config['mod_writer'] ? 'fileuser-' . $usrcp->id() . '.html' : 'ucp.php?go=fileuser&amp;id=' . $usrcp->id());
if($user_himself) if ($user_himself)
{ {
$used_storage = $userinfo['storage_size']; $used_storage = $userinfo['storage_size'];
$max_storage = $d_groups[$usrcp->group_id()]['configs']['max_storage']; $max_storage = $d_groups[$usrcp->group_id()]['configs']['max_storage'];
$is_limited = $max_storage>0; $is_limited = $max_storage>0;
if($is_limited) if ($is_limited)
{ {
$storage_per = ($used_storage*100)/$max_storage; $storage_per = ($used_storage*100)/$max_storage;
$storage_per = round($storage_per, 2); $storage_per = round($storage_per, 2);