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

Auto discovery broken in Symfony 4.4 ? #363

Closed
XWB opened this issue Nov 28, 2019 · 4 comments
Closed

Auto discovery broken in Symfony 4.4 ? #363

XWB opened this issue Nov 28, 2019 · 4 comments

Comments

@XWB
Copy link

XWB commented Nov 28, 2019

After upgrading to Symfony 4.4, I got the following error:

bin/console

image

Stack trace:

[Http\Discovery\Exception\ClassInstantiationFailedException]  
  Unexpected exception when instantiating class

  at vendor/php-http/discovery/src/ClassDiscovery.php:210
 Http\Discovery\ClassDiscovery::instantiateClass() at vendor/php-http/discovery/src/HttpClientDiscovery.php:34
 Http\Discovery\HttpClientDiscovery::find() at vendor/friendsofapi/localise.biz/src/HttpClientConfigurator.php:59
 FAPI\Localise\HttpClientConfigurator->__construct() at var/cache/dev/ContainerBZs79FG/getPhpTranslation_Adapter_LocoService.php:17
 require() at var/cache/dev/ContainerBZs79FG/srcApp_KernelDevDebugContainer.php:742
 ContainerBZs79FG\srcApp_KernelDevDebugContainer->load() at var/cache/dev/ContainerBZs79FG/getPhpTranslation_Storage_WdaService.php:16
 require() at var/cache/dev/ContainerBZs79FG/srcApp_KernelDevDebugContainer.php:742
 ContainerBZs79FG\srcApp_KernelDevDebugContainer->load() at var/cache/dev/ContainerBZs79FG/getPhpTranslation_StorageManagerService.php:13
 require() at var/cache/dev/ContainerBZs79FG/srcApp_KernelDevDebugContainer.php:742
 ContainerBZs79FG\srcApp_KernelDevDebugContainer->load() at var/cache/dev/ContainerBZs79FG/getPhpTranslator_Console_DeleteObsoleteService.php:15
 require() at var/cache/dev/ContainerBZs79FG/srcApp_KernelDevDebugContainer.php:742
 ContainerBZs79FG\srcApp_KernelDevDebugContainer->load() at vendor/symfony/dependency-injection/Container.php:444
 Symfony\Component\DependencyInjection\Container->getService() at vendor/symfony/dependency-injection/Argument/ServiceLocator.php:40
 Symfony\Component\DependencyInjection\Argument\ServiceLocator->get() at vendor/symfony/console/CommandLoader/ContainerCommandLoader.php:45
 Symfony\Component\Console\CommandLoader\ContainerCommandLoader->get() at vendor/symfony/console/Application.php:542
 Symfony\Component\Console\Application->has() at vendor/symfony/console/Application.php:743
 Symfony\Component\Console\Application->all() at vendor/symfony/framework-bundle/Console/Application.php:143
 Symfony\Bundle\FrameworkBundle\Console\Application->all() at vendor/symfony/console/Descriptor/ApplicationDescription.php:91
 Symfony\Component\Console\Descriptor\ApplicationDescription->inspectApplication() at vendor/symfony/console/Descriptor/ApplicationDescription.php:68
 Symfony\Component\Console\Descriptor\ApplicationDescription->getCommands() at vendor/symfony/console/Descriptor/TextDescriptor.php:202
 Symfony\Component\Console\Descriptor\TextDescriptor->describeApplication() at vendor/symfony/console/Descriptor/Descriptor.php:55
 Symfony\Component\Console\Descriptor\Descriptor->describe() at vendor/symfony/console/Helper/DescriptorHelper.php:67
 Symfony\Component\Console\Helper\DescriptorHelper->describe() at vendor/symfony/console/Command/ListCommand.php:75
 Symfony\Component\Console\Command\ListCommand->execute() at vendor/symfony/console/Command/Command.php:255
 Symfony\Component\Console\Command\Command->run() at vendor/symfony/console/Application.php:1029
 Symfony\Component\Console\Application->doRunCommand() at vendor/symfony/framework-bundle/Console/Application.php:100
 Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand() at vendor/symfony/console/Application.php:272
 Symfony\Component\Console\Application->doRun() at vendor/symfony/framework-bundle/Console/Application.php:83
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at bin/console:36

Related packages I have installed:

php-http/guzzle6-adapter
php-translation/symfony-bundle
php-translation/loco-adapter

I fixed it by installing http-interop/http-factory-guzzle but I wonder what has changed in Symfony 4.4 that broke the http discovery?

@mbabker
Copy link

mbabker commented Dec 4, 2019

The HttpClient component added a class bridging the client's interface with Httplug, and it looks like the auto discovery expects if that class is available that it can use the PSR-17 discovery path, but none of the classes satisfying the PSR-17 discovery path are available (at least in the case I ran into this on where the HttpClient was being pulled in as a transient dependency to something else). So it feels like there's some dependency check missing somewhere in the tree, and that part I didn't really get time to dig in to (I just pinned the HttpClient component to 4.3.* to get rid of the immediate error).

@OskarStark
Copy link

(I just pinned the HttpClient component to 4.3.* to get rid of the immediate error).

That worked for me too 👍

@dbu
Copy link
Collaborator

dbu commented Dec 27, 2019

did php-http/discovery#151 fix this for you? using discovery 1.7.2 should work again, right?

@lordjancso
Copy link

Tested and it works with discovery 1.7.3. Thank you for the fix and this issue can be closed.

@xabbuh xabbuh closed this as completed Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants