Search code examples
phpyiiupdatescraftcms

How can I resole a fatal error that appeard after updating Craft CMS?


I want to update to a newer craft CMS version, and I tried to do it in the control panel. The latest available version was 3.7.12. After I clicked on update all I got the following error:

Fatal error: Declaration of

craft\helpers\FileHelper::getExtensionByMimeType($mimeType): string must be compatible with yii\helpers\BaseFileHelper::getExtensionByMimeType($mimeType, $preferShort = false, $magicFile = null) in /var/www/html/vendor/craftcms/cms/src/helpers/FileHelper.php on line 719

Later, I updated successfully to version 3.8.2 using the terminal. All dependencies are also updated and yiisoft/yii2 version is set to 2.0.45. However, the problem still stays.

The solutions I tried are the ones here but it didn't solve the problem for me.


Solution

  • Running composer install in /var/www/html fixed the issue