Liipimaginebundle: Incompatibility with Symfony 5: Usage of class that does not exist anymore

Created on 8 Jun 2020  路  4Comments  路  Source: liip/LiipImagineBundle

Symfony version(s) affected: 5.1.0 and 5.0.9

Description

This error message is thrown when I call bin/console:

In getLiipImagine_MimeTypeGuesserService.php line 20:
Attempted to load class "MimeTypeGuesser" from namespace "Symfony\Component\HttpFoundation\File\MimeType".
Did you forget a "use" statement for another namespace?

The classes specified in... https://github.com/liip/LiipImagineBundle/blob/16c28a8c84aee044504a3fe5db9f5282e53e5f95/Resources/config/imagine.xml#L368-L374 ...do not exist in SF 5.x anymore. So it seems liip/imagine-bundle is not fully compatible with sf 5 yet.

How to reproduce

These commands run WITHOUT any problem:

symfony new --version=4.4 foo
cd foo
composer req liip/imagine-bundle          (answer interactive question with 'y'!)
bin/console -vvv

These commands lead to the error message mentioned above:

symfony new --version=5.1 foo
cd foo
composer req liip/imagine-bundle          (answer interactive question with 'y'!)
bin/console -vvv

Additional context

Exception trace:
at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/getLiipImagine_MimeTypeGuesserService.php:20
ContainerYn76KfG\getLiipImagine_MimeTypeGuesserService::do() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/App_KernelDevDebugContainer.php:169
ContainerYn76KfG\App_KernelDevDebugContainer->load() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/getLiipImagine_Binary_MimeTypeGuesserService.php:23
ContainerYn76KfG\getLiipImagine_Binary_MimeTypeGuesserService::do() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/App_KernelDevDebugContainer.php:169
ContainerYn76KfG\App_KernelDevDebugContainer->load() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/getLiipImagine_Filter_ManagerService.php:49
ContainerYn76KfG\getLiipImagine_Filter_ManagerService::do() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/App_KernelDevDebugContainer.php:169
ContainerYn76KfG\App_KernelDevDebugContainer->load() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/getLiipImagine_Command_CacheRemoveService.php:24
ContainerYn76KfG\getLiipImagine_Command_CacheRemoveService::do() at /Volumes/sd_card/foo/var/cache/dev/ContainerYn76KfG/App_KernelDevDebugContainer.php:169
ContainerYn76KfG\App_KernelDevDebugContainer->load() at /Volumes/sd_card/foo/vendor/symfony/dependency-injection/Container.php:441
Symfony\Component\DependencyInjection\Container->getService() at /Volumes/sd_card/foo/vendor/symfony/dependency-injection/Argument/ServiceLocator.php:40
Symfony\Component\DependencyInjection\Argument\ServiceLocator->get() at /Volumes/sd_card/foo/vendor/symfony/console/CommandLoader/ContainerCommandLoader.php:45
Symfony\Component\Console\CommandLoader\ContainerCommandLoader->get() at /Volumes/sd_card/foo/vendor/symfony/console/Application.php:520
Symfony\Component\Console\Application->has() at /Volumes/sd_card/foo/vendor/symfony/console/Application.php:716
Symfony\Component\Console\Application->all() at /Volumes/sd_card/foo/vendor/symfony/framework-bundle/Console/Application.php:142
Symfony\Bundle\FrameworkBundle\Console\Application->all() at /Volumes/sd_card/foo/vendor/symfony/console/Descriptor/ApplicationDescription.php:91
Symfony\Component\Console\Descriptor\ApplicationDescription->inspectApplication() at /Volumes/sd_card/foo/vendor/symfony/console/Descriptor/ApplicationDescription.php:68
Symfony\Component\Console\Descriptor\ApplicationDescription->getCommands() at /Volumes/sd_card/foo/vendor/symfony/console/Descriptor/TextDescriptor.php:202
Symfony\Component\Console\Descriptor\TextDescriptor->describeApplication() at /Volumes/sd_card/foo/vendor/symfony/console/Descriptor/Descriptor.php:55
Symfony\Component\Console\Descriptor\Descriptor->describe() at /Volumes/sd_card/foo/vendor/symfony/console/Helper/DescriptorHelper.php:65
Symfony\Component\Console\Helper\DescriptorHelper->describe() at /Volumes/sd_card/foo/vendor/symfony/console/Command/ListCommand.php:75
Symfony\Component\Console\Command\ListCommand->execute() at /Volumes/sd_card/foo/vendor/symfony/console/Command/Command.php:258
Symfony\Component\Console\Command\Command->run() at /Volumes/sd_card/foo/vendor/symfony/console/Application.php:929
Symfony\Component\Console\Application->doRunCommand() at /Volumes/sd_card/foo/vendor/symfony/framework-bundle/Console/Application.php:99
Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at /Volumes/sd_card/foo/vendor/symfony/console/Application.php:264
Symfony\Component\Console\Application->doRun() at /Volumes/sd_card/foo/vendor/symfony/framework-bundle/Console/Application.php:82
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Volumes/sd_card/foo/vendor/symfony/console/Application.php:140
Symfony\Component\Console\Application->run() at /Volumes/sd_card/foo/bin/console:43

Most helpful comment

Encountered same issue on Symfony 5.1.
There is an additional required dependency that you need to install to get rid of this error :

composer require symfony/mime

But we still miss a proper fix for that.

All 4 comments

Encountered same issue on Symfony 5.1.
There is an additional required dependency that you need to install to get rid of this error :

composer require symfony/mime

But we still miss a proper fix for that.

Encountered same issue on Symfony 5.1.
There is an additional required dependency that you need to install to get rid of this error :

composer require symfony/mime

But we still miss a proper fix for that.

This did not fix it at all for me and I am still getting the same error. What version of symfony/mime and symfony are you guys using? I'm using Symfony v5.1.7 with symfony/mime v5.1.7.

Did this fix it for you guys because you are running an old version of Symfony before the deprecated MimeTypeGuesser was removed?

Ah I figured out my issue. I was defining a custom data loader that extended the existing FileSystemLoader. I had to pass the @mime_types service for both the $mimeGuesser and $extensionGuesser service arguments that FileSystemLoader expected. This fixed the problem for me and got it to actually work.

Still waiting for the proper fix though.

Was this page helpful?
0 / 5 - 0 ratings