Fix #19041: Fix PHP 8.1 issues

This commit is contained in:
Alexander Makarov
2022-01-14 13:52:01 +03:00
committed by GitHub
parent 4bd551d143
commit 1271bc419f
49 changed files with 162 additions and 53 deletions

View File

@@ -161,6 +161,11 @@ class BaseFileHelper
throw new InvalidConfigException('The fileinfo PHP extension is not installed.');
}
if (PHP_VERSION_ID >= 80100) {
return static::getMimeTypeByExtension($file, $magicFile);
}
$info = finfo_open(FILEINFO_MIME_TYPE, $magicFile);
if ($info) {
@@ -900,7 +905,7 @@ class BaseFileHelper
*/
public static function changeOwnership($path, $ownership, $mode = null)
{
if (!file_exists($path)) {
if (!file_exists((string)$path)) {
throw new InvalidArgumentException('Unable to change ownerhip, "' . $path . '" is not a file or directory.');
}