Skip to content

Noticed exception 'TypeError' when the product_list_order parameter is an array. #37827

Open
@adam-krakowski-accenture

Description

Preconditions and environment

  • Magento version: Adobe Commerce ver. 2.4.4-p4

Steps to reproduce

  1. Go to storefront, then into categories to see the products.
  2. Change the product_list_order parameter in the URL to an array type.
  3. Refresh the page with changed URL.

Examples of URL:
https://release4.proshop.pg.com/whitening/crest-whitestrips.html?product_list_order[]=price&product_list_dir=desc
https://ca.magento2.local/shop-by-product/crest-whitening.html?product_list_order[]

Expected result

The product_list_order parameter with an array type is handled correctly.

vendor/magento/module-catalog/Model/Product/ProductList/ToolbarMemorizer.php
The getOrder() function returns string|bool value as described in the @return tag

Actual result

TypeError: Illegal offset type in isset or empty in /var/www/magento/vendor/magento/module-catalog/Block/Product/ProductList/Toolbar.php:280

vendor/magento/module-catalog/Model/Product/ProductList/ToolbarMemorizer.php
The getOrder() function returns array value (invalid @return tag), which causes a TypeError

Additional information

TypeError: Illegal offset type in isset or empty in /var/www/magento/vendor/magento/module-catalog/Block/Product/ProductList/Toolbar.php:280
Stack trace:
#0 /var/www/magento/app/code/PG/GaGtm/Model/ProductCollection/CategoryCollectionFilter.php(62): Magento\Catalog\Block\Product\ProductList\Toolbar->getCurrentOrder()
#1 /var/www/magento/app/code/PG/GaGtm/Model/ProductCollection/CollectionGetter.php(46): PG\GaGtm\Model\ProductCollection\CategoryCollectionFilter->filter()
#2 /var/www/magento/app/code/PG/GaGtm/Observer/Products/LoadCollection.php(58): PG\GaGtm\Model\ProductCollection\CollectionGetter->getCollection()
#3 /var/www/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(88): PG\GaGtm\Observer\Products\LoadCollection->execute()
#4 /var/www/magento/vendor/magento/framework/Event/Invoker/InvokerDefault.php(74): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod()
#5 /var/www/magento/vendor/magento/module-staging/Model/Event/Manager.php(97): Magento\Framework\Event\Invoker\InvokerDefault->dispatch()
#6 /var/www/magento/generated/code/Magento/Staging/Model/Event/Manager/Proxy.php(95): Magento\Staging\Model\Event\Manager->dispatch()
#7 /var/www/magento/vendor/magento/framework/View/Result/Layout.php(169): Magento\Staging\Model\Event\Manager\Proxy->dispatch()
#8 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult()
#9 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent()
#10 /var/www/magento/vendor/magezon/module-core/Plugin/View/Result/Layout.php(24): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception{closure}()
#11 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(135): Magezon\Core\Plugin\View\Result\Layout->aroundRenderResult()
#12 /var/www/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception{closure}()
#13 /var/www/magento/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(95): Magento\Framework\View\Result\Page\Interceptor->___callPlugins()
#14 /var/www/magento/vendor/magento/framework/App/Http.php(120): Magento\Framework\View\Result\Page\Interceptor->renderResult()
#15 /var/www/magento/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#16 /var/www/magento/vendor/magento/framework/App/Bootstrap.php(267): Magento\Framework\App\Http\Interceptor->launch()
#17 /var/www/magento/pub/index.php(30): Magento\Framework\App\Bootstrap->run()

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Area: SEOComponent: UrlIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressReported on 2.4.4-p4Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions