magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.31k forks source link

TypeError when loading UPS shipping rates if no allowed shipping methods selected #34411

Closed NicholasRoge closed 2 years ago

NicholasRoge commented 2 years ago

Preconditions (*)

  1. Magento version 2.4.3
  2. Admin - Stores - Configuration - Sales - Shipping Methods - UPS shipping method is set up with no "Allowed Methods" selected
  3. cache clear
  4. Front end - Login as customer - Add a product to Cart
  5. Proceed to checkout - Enter Shipping Address Issue: No other shipping methods are displayed and error is displayed on UI. Unable to proceed with payment.

    Steps to reproduce (*)

  6. Add test simple product to cart
  7. Proceed to checkout
  8. Enter shipping address

Expected result (*)

My expectation is that the exception should never occur in the first place and the carrier should return no rates if there are no allowed shipping methods

Actual result (*)

Actual result is that all rates fail to load and no error is logged to indicate that there is an issue.

If you attempt to load rates an RMA request however, the following error which is caused by the issue in question is logged:

[2021-10-22 20:57:42] report.CRITICAL: Type Error occurred when creating object: Magento\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shipping\Methods, explode() expects parameter 2 to be string, null given [] []
[2021-10-22 20:57:42] report.CRITICAL: Type Error occurred when creating object: Magento\Rma\Block\Adminhtml\Rma\Edit\Tab\General\Shipping\Methods, explode() expects parameter 2 to be string, null given [] []
[2021-10-22 20:57:42] report.CRITICAL: Error: Call to a member function toHtml() on bool in /var/www/html/vendor/magento/module-rma/Controller/Adminhtml/Rma/ShowShippingMethods.php:52
Stack trace:
#0 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods->execute()
#1 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->___callParent()
#2 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->Magento\Framework\Interception\{closure}()
#3 /var/www/html/generated/code/Magento/Rma/Controller/Adminhtml/Rma/ShowShippingMethods/Interceptor.php(23): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->___callPlugins()
#4 /var/www/html/vendor/magento/framework/App/Action/Action.php(111): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->execute()
#5 /var/www/html/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#6 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch()
#7 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->___callParent()
#8 /var/www/html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->Magento\Framework\Interception\{closure}()
#9 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
#10 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->Magento\Framework\Interception\{closure}()
#11 /var/www/html/generated/code/Magento/Rma/Controller/Adminhtml/Rma/ShowShippingMethods/Interceptor.php(32): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->___callPlugins()
#12 /var/www/html/vendor/magento/framework/App/FrontController.php(245): Magento\Rma\Controller\Adminhtml\Rma\ShowShippingMethods\Interceptor->dispatch()
#13 /var/www/html/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#14 /var/www/html/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#15 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#16 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#17 /var/www/html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#18 /var/www/html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#19 /var/www/html/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#20 /var/www/html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#21 /var/www/html/pub/index.php(29): Magento\Framework\App\Bootstrap->run()
#22 {main} [] []

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

m2-assistant[bot] commented 2 years ago

Hi @NicholasRoge. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

NicholasRoge commented 2 years ago

@magento I am working on this

m2-assistant[bot] commented 2 years ago

Hi @NicholasRoge! :wave: Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team command to join Contributors team.

NicholasRoge commented 2 years ago

@magento add to contributors team

m2-assistant[bot] commented 2 years ago

Hi @NicholasRoge! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.

NicholasRoge commented 2 years ago

@magento I am working on this

m2-assistant[bot] commented 2 years ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 2 years ago

Verified the issue on Magento 2.4-develop branch and the issue is reproducible: image Exception stack trace: ` [2021-12-24T11:27:33.855730+00:00] main.CRITICAL: TypeError: explode() expects parameter 2 to be string, null given in /var/www/html/mg24/magento2/app/code/Magento/Ups/Model/Carrier.php:920 Stack trace:

0 /var/www/html/mg24/magento2/app/code/Magento/Ups/Model/Carrier.php(920): explode()

1 /var/www/html/mg24/magento2/app/code/Magento/Ups/Model/Carrier.php(858): Magento\Ups\Model\Carrier->_parseXmlResponse()

2 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/Async/CallbackDeferred.php(99): Magento\Ups\Model\Carrier->Magento\Ups\Model{closure}()

3 /var/www/html/mg24/magento2/generated/code/Magento/Shipping/Model/Rate/Result/ProxyDeferred.php(61): Magento\Framework\Async\CallbackDeferred->get()

4 /var/www/html/mg24/magento2/generated/code/Magento/Shipping/Model/Rate/Result/ProxyDeferred.php(92): Magento\Shipping\Model\Rate\Result\ProxyDeferred->wait()

5 /var/www/html/mg24/magento2/generated/code/Magento/Shipping/Model/Rate/Result/ProxyDeferred.php(93): Magento\Shipping\Model\Rate\Result\ProxyDeferred->getError()

6 /var/www/html/mg24/magento2/app/code/Magento/Shipping/Model/Rate/CarrierResult.php(41): Magento\Shipping\Model\Rate\Result\ProxyDeferred->getError()

7 /var/www/html/mg24/magento2/app/code/Magento/Quote/Model/Quote/Address.php(1081): Magento\Shipping\Model\Rate\CarrierResult->getAllRates()

8 /var/www/html/mg24/magento2/app/code/Magento/Quote/Model/Quote/Address.php(1004): Magento\Quote\Model\Quote\Address->requestShippingRates()

9 /var/www/html/mg24/magento2/app/code/Magento/Quote/Model/Quote/Address/Total/Shipping.php(83): Magento\Quote\Model\Quote\Address->collectShippingRates()

10 /var/www/html/mg24/magento2/app/code/Magento/Quote/Model/Quote/TotalsCollector.php(261): Magento\Quote\Model\Quote\Address\Total\Shipping->collect()

11 /var/www/html/mg24/magento2/app/code/Magento/Quote/Model/ShippingMethodManagement.php(330): Magento\Quote\Model\Quote\TotalsCollector->collectAddressTotals()

12 /var/www/html/mg24/magento2/app/code/Magento/Quote/Model/ShippingMethodManagement.php(283): Magento\Quote\Model\ShippingMethodManagement->getShippingMethods()

13 [internal function]: Magento\Quote\Model\ShippingMethodManagement->estimateByAddressId()

14 /var/www/html/mg24/magento2/app/code/Magento/Webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array()

15 /var/www/html/mg24/magento2/app/code/Magento/Webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process()

16 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch()

17 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent()

18 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception{closure}()

19 /var/www/html/mg24/magento2/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins()

20 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch()

21 /var/www/html/mg24/magento2/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()

22 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()

23 /var/www/html/mg24/magento2/pub/index.php(30): Magento\Framework\App\Bootstrap->run()

24 {main} [] []

`

github-jira-sync-bot commented 2 years ago

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-2052 is successfully created for this GitHub issue.

m2-assistant[bot] commented 2 years ago

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

engcom-Hotel commented 2 years ago

Hello @NicholasRoge,

Thanks for reporting the issue!

The issue has been fixed and delivered by the internal team. Related commits can be found here.

Thanks