magewire icon indicating copy to clipboard operation
magewire copied to clipboard

V1: Adding symfony/http-kernel requirement

Open callum-zero1 opened this issue 2 years ago • 2 comments

There is a requirement for the symfony/http-kernel package that isn't defined in the composer.json.

Example error:

[2023-06-13 07:29:59] main.CRITICAL: Error: Class 'Symfony\Component\HttpKernel\Exception\HttpException' not found in /home/magento/htdocs/vendor/hyva-themes/magento2-hyva-checkout/src/Model/Magewire/Component/Resolver/Checkout.php:78
Stack trace:
#0 /home/magento/htdocs/vendor/magewirephp/magewire/src/Controller/Post/Livewire.php(106): Hyva\Checkout\Model\Magewire\Component\Resolver\Checkout->reconstruct(Object(Magewirephp\Magewire\Model\Request))
#1 /home/magento/htdocs/generated/code/Magewirephp/Magewire/Controller/Post/Livewire/Interceptor.php(32): Magewirephp\Magewire\Controller\Post\Livewire->locateWireComponent(Array)
#2 /home/magento/htdocs/vendor/magewirephp/magewire/src/Controller/Post/Livewire.php(75): Magewirephp\Magewire\Controller\Post\Livewire\Interceptor->locateWireComponent(Array)
#3 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magewirephp\Magewire\Controller\Post\Livewire->execute()
#4 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magewirephp\Magewire\Controller\Post\Livewire\Interceptor->___callParent('execute', Array)
#5 /home/magento/htdocs/vendor/magento/framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php(51): Magewirephp\Magewire\Controller\Post\Livewire\Interceptor->Magento\Framework\Interception\{closure}()
#6 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin->aroundExecute(Object(Magewirephp\Magewire\Controller\Post\Livewire\Interceptor), Object(Closure))
#7 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magewirephp\Magewire\Controller\Post\Livewire\Interceptor->Magento\Framework\Interception\{closure}()
#8 /home/magento/htdocs/generated/code/Magewirephp/Magewire/Controller/Post/Livewire/Interceptor.php(23): Magewirephp\Magewire\Controller\Post\Livewire\Interceptor->___callPlugins('execute', Array, Array)
#9 /home/magento/htdocs/vendor/magento/framework/App/FrontController.php(188): Magewirephp\Magewire\Controller\Post\Livewire\Interceptor->execute()
#10 /home/magento/htdocs/vendor/magento/framework/App/FrontController.php(118): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magewirephp\Magewire\Controller\Post\Livewire\Interceptor))
#11 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#12 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#13 /home/magento/htdocs/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#14 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#15 /home/magento/htdocs/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(71): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#16 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#17 /home/magento/htdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#18 /home/magento/htdocs/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#19 /home/magento/htdocs/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#20 /home/magento/htdocs/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#21 /home/magento/htdocs/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http\Interceptor->launch()
#22 /home/magento/htdocs/pub/index.php(29): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#23 {main} [] []

I have removed the requirement of symfony/http-foundation as this is now required by symfony/http-kernel.

I required version 4.4 because requiring 5.4 (matching the previously declared symfony/http-foundation requirement version) causes conflicts with other Symfony packages used by Magento 2.4.2.

magento/product-community-edition  2.4.2     requires  symfony/event-dispatcher (~4.4.0)
magento/product-community-edition  2.4.2     requires  symfony/console (~4.4.0)

callum-zero1 avatar Jun 13 '23 08:06 callum-zero1

@callum-zero1,

How can we be sure this isn't gonna conflict elsewhere on a higher Magento version?

I've been looking into https://github.com/magewirephp/magewire/pull/98 again. Maybe it's a better idea to try and get rid of any \Symfony\Component\HttpKernel\Exception\HttpException exception.

Not sure if it's possible, but if it's the only place where this is being used, it could be the better solution.

wpoortman avatar Jun 13 '23 09:06 wpoortman

My 50 cents here: https://github.com/magewirephp/magewire/pull/135

jissereitsma avatar Oct 27 '23 09:10 jissereitsma