Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
markwatney2016 opened this issue Jun 8, 2020 · 5 comments · Fixed by #1379
Closed

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

markwatney2016 opened this issue Jun 8, 2020 · 5 comments · Fixed by #1379
Labels
Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality.

Comments

@markwatney2016
Copy link

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...

<service id="liip_imagine.mime_type_guesser" class="Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesserInterface">
<factory class="Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser" method="getInstance" />
</service>
<service id="liip_imagine.extension_guesser" class="Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesserInterface">
<factory class="Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser" method="getInstance" />
</service>
...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
@yann-eugone
Copy link

yann-eugone commented Jun 9, 2020

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.

@skylord123
Copy link

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?

@skylord123
Copy link

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.

@mbabker
Copy link
Contributor

mbabker commented Jun 8, 2021

#1379 should fix this in a B/C manner.

@dbu dbu added the Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality. label Oct 6, 2021
@dbu dbu closed this as completed in #1379 Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Level: Bug 🐞 This item involves a legitimate regression (bug) to existing functionality.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants