amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
109 stars 77 forks source link

ParadoxLabsSubscriptionManager triggers deprecated notice on PHP 8.2 #1252

Open navarr opened 2 days ago

navarr commented 2 days ago

What I expected

PLP To load

What happened instead

Exception #0 (Exception): Deprecated Functionality: Creation of dynamic property Amazon\Pay\Model\Subscription\ParadoxLabsSubscriptionManager::$quoteManager is deprecated in /var/www/html/vendor/amzn/amazon-pay-magento-2-module/Model/Subscription/SubscriptionManagerFactory.php on line 67

#1 Amazon\Pay\Model\Subscription\SubscriptionManagerFactory->initialize() called at [vendor/amzn/amazon-pay-magento-2-module/Model/Subscription/SubscriptionManager.php:37]
#2 Amazon\Pay\Model\Subscription\SubscriptionManager->__construct(&Amazon\Pay\Model\Subscription\SubscriptionManagerFactory#0000000000000a110000000000000000#) called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]
#3 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Amazon\Pay\Model...', array(&Amazon\Pay\Model\Subscription\SubscriptionManagerFactory#0000000000000a110000000000000000#)) called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]
#4 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Amazon\Pay\Model...') called at [vendor/magento/framework/ObjectManager/ObjectManager.php:73]
#5 Magento\Framework\ObjectManager\ObjectManager->get('Amazon\Pay\Model...') called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170]
#6 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(array('instance' => 'Amazon\Pay\Model...'), 'Amazon\Pay\Model...', NULL, 'subscriptionMana...', 'Amazon\Pay\Block...') called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]
#7 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Amazon\Pay\Block...', array('subscriptionMana...', 'Amazon\Pay\Model...', true, NULL, false), array('data' => array())) called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]
#8 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Amazon\Pay\Block...', array(array('context', 'Magento\Framewor...', true, NULL, false), array('amazonHelper', 'Amazon\Pay\Helpe...', true, NULL, false), array('amazonConfig', 'Amazon\Pay\Model...', true, NULL, false), array('subscriptionMana...', 'Amazon\Pay\Model...', true, NULL, false)), array('data' => array())) called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]
#9 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Amazon\Pay\Block...', array(array('context', 'Magento\Framewor...', true, NULL, false), array('amazonHelper', 'Amazon\Pay\Helpe...', true, NULL, false), array('amazonConfig', 'Amazon\Pay\Model...', true, NULL, false), array('subscriptionMana...', 'Amazon\Pay\Model...', true, NULL, false)), array('data' => array())) called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]
#10 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Amazon\Pay\Block...', array('data' => array())) called at [vendor/magento/framework/ObjectManager/ObjectManager.php:59]
#11 Magento\Framework\ObjectManager\ObjectManager->create('Amazon\Pay\Block...', array('data' => array())) called at [vendor/magento/framework/View/Element/BlockFactory.php:44]
#12 Magento\Framework\View\Element\BlockFactory->createBlock('Amazon\Pay\Block...', array('data' => array())) called at [vendor/magento/framework/View/Layout/Generator/Block.php:272]
#13 Magento\Framework\View\Layout\Generator\Block->getBlockInstance('Amazon\Pay\Block...', array('data' => array())) called at [vendor/magento/framework/View/Layout/Generator/Block.php:252]
#14 Magento\Framework\View\Layout\Generator\Block->createBlock('Amazon\Pay\Block...', 'amazon_pay_confi...', array('data' => array())) called at [vendor/magento/framework/View/Layout/Generator/Block.php:225]
#15 Magento\Framework\View\Layout\Generator\Block->generateBlock(&Magento\Framework\View\Layout\ScheduledStructure#00000000000008220000000000000000#, &Magento\Framework\View\Layout\Data\Structure#00000000000002d00000000000000000#, 'amazon_pay_confi...') called at [vendor/magento/framework/View/Layout/Generator/Block.php:134]
#16 Magento\Framework\View\Layout\Generator\Block->process(&Magento\Framework\View\Layout\Reader\Context#00000000000008320000000000000000#, &Magento\Framework\View\Layout\Generator\Context#000000000000085b0000000000000000#) called at [vendor/magento/framework/View/Layout/GeneratorPool.php:93]
#17 Magento\Framework\View\Layout\GeneratorPool->process(&Magento\Framework\View\Layout\Reader\Context#00000000000008320000000000000000#, &Magento\Framework\View\Layout\Generator\Context#000000000000085b0000000000000000#) called at [vendor/magento/framework/View/Layout.php:365]
#18 Magento\Framework\View\Layout->generateElements() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#19 Magento\Framework\View\Layout\Interceptor->___callParent('generateElements', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#20 Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#21 Magento\Framework\View\Layout\Interceptor->___callPlugins('generateElements', array(), array(array('layout-model-cac...', 'core-session-dep...', 'customer-session...', 'catalog-session-...', 'persistent-sessi...', 'customer-segment...', 'checkout-session...', 'tax-session-depe...', 'fastly_adjust_he...'))) called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:68]
#22 Magento\Framework\View\Layout\Interceptor->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#23 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:65]
#24 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#25 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Page/Config.php:227]
#26 Magento\Framework\View\Page\Config->build() called at [vendor/magento/framework/View/Page/Config.php:591]
#27 Magento\Framework\View\Page\Config->getElementAttribute('body', 'class') called at [generated/code/Magento/Framework/View/Page/Config/Interceptor.php:248]
#28 Magento\Framework\View\Page\Config\Interceptor->getElementAttribute('body', 'class') called at [vendor/magento/framework/View/Page/Config.php:549]
#29 Magento\Framework\View\Page\Config->addBodyClass('page-products') called at [generated/code/Magento/Framework/View/Page/Config/Interceptor.php:230]
#30 Magento\Framework\View\Page\Config\Interceptor->addBodyClass('page-products') called at [vendor/magento/module-catalog/Controller/Category/View.php:248]
#31 Magento\Catalog\Controller\Category\View->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#32 Magento\Catalog\Controller\Category\View\Interceptor->___callParent('execute', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#33 Magento\Catalog\Controller\Category\View\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#34 Magento\Catalog\Controller\Category\View\Interceptor->___callPlugins('execute', array(), array(array('storeCheck', 'designLoader', 'customerNotifica...', 'tax-app-action-d...', 'weee-app-action-...', 'invalidate_expir...', 'replaceIndex', 'before-action', 'customer-app-act...'), array('Aeroflow_Catalog...'))) called at [generated/code/Magento/Catalog/Controller/Category/View/Interceptor.php:23]
#35 Magento\Catalog\Controller\Category\View\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#36 Magento\Framework\App\Action\Action->dispatch(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#37 Magento\Catalog\Controller\Category\View\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#38 Magento\Catalog\Controller\Category\View\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/module-company/Plugin/Framework/App/Action/AbstractActionPlugin.php:65]
#39 Magento\Company\Plugin\Framework\App\Action\AbstractActionPlugin->aroundDispatch(&Magento\Catalog\Controller\Category\View\Interceptor#00000000000007300000000000000000#, &Closure#00000000000007390000000000000000#, &Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#40 Magento\Catalog\Controller\Category\View\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#41 Magento\Catalog\Controller\Category\View\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#), array(array('contextPlugin', 'customer-segment...'))) called at [generated/code/Magento/Catalog/Controller/Category/View/Interceptor.php:32]
#42 Magento\Catalog\Controller\Category\View\Interceptor->dispatch(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/App/FrontController.php:245]
#43 Magento\Framework\App\FrontController->getActionResponse(&Magento\Catalog\Controller\Category\View\Interceptor#00000000000007300000000000000000#, &Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/App/FrontController.php:212]
#44 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#, &Magento\Catalog\Controller\Category\View\Interceptor#00000000000007300000000000000000#) called at [vendor/magento/framework/App/FrontController.php:146]
#45 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:58]
#46 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#47 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
#48 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#00000000000001da0000000000000000#, &Closure#00000000000002030000000000000000#, &Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#49 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/fastly/magento2/Model/FrontControllerPlugin.php:128]
#50 Fastly\Cdn\Model\FrontControllerPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#00000000000001da0000000000000000#, &Closure#00000000000002030000000000000000#, &Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#51 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:72]
#52 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#00000000000001da0000000000000000#, &Closure#00000000000002030000000000000000#, &Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#53 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:153]
#54 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#), NULL) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#55 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#00000000000000180000000000000000#) called at [vendor/magento/framework/App/Http.php:116]
#56 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#57 Magento\Framework\App\Http\Interceptor->___callParent('launch', array()) called at [vendor/magento/framework/Interception/Interceptor.php:138]
#58 Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-application-performance-monitor/Plugin/ApplicationPerformanceMonitor.php:38]
#59 Magento\ApplicationPerformanceMonitor\Plugin\ApplicationPerformanceMonitor->aroundLaunch(&Magento\Framework\App\Http\Interceptor#00000000000000a60000000000000000#, &Closure#00000000000001080000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#60 Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/graycore/magento2-cors/Plugin/FastLauncher.php:71]
#61 Graycore\Cors\Plugin\FastLauncher->aroundLaunch(&Magento\Framework\App\Http\Interceptor#00000000000000a60000000000000000#, &Closure#00000000000001080000000000000000#) called at [vendor/magento/framework/Interception/Interceptor.php:135]
#62 Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#63 Magento\Framework\App\Http\Interceptor->___callPlugins('launch', array(), NULL) called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#64 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#65 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#00000000000000a60000000000000000#) called at [pub/index.php:30]

Steps to reproduce the issue

This happened when I loaded a PLP with the Amazon Pay module installed.

Looking at the class, it appears incomplete. While the error I'm getting is deprecated functionality, if those methods were actually called it'd likely be NPE since I don't see those properties declared or set anywhere.

Your setup

sgabhart22 commented 1 day ago

Hi @navarr ,

If you check the di.xml, these members are defined as part of the object pool. Could you please try to setup:di:compile once more and let us know if you still see the error? I am unable to reproduce on a 2.4.7-p2 instance running PHP8.2.

Thanks, Spencer

navarr commented 1 day ago

I mis-titled this but I definitely still see the same error, since this functionality is deprecated. I've prepared a PR #1253 that resolves this error.

I'm guessing these classes aren't in the constructor so that there's not a hard dependency on ParadoxLabs. Technically the correct approach would be to separate the functionality that requires ParadoxLabs into a second, optional, module that can have that hard dependency - though I can imagine why that approach wasn't taken.

sgabhart22 commented 1 day ago

Thanks for the PR @navarr ! Odd that I seem to be incapable of reproducing this on PHP8.2 and above... but your point stands, and there's certainly no harm in explicitly declaring those variables ahead of time.

Just FYI, we typically won't merge user-submitted PRs directly, but we can cherry pick your commit into our next release branch so you get proper credit for the fix 🙂

Thanks again, Spencer