Skip to content

Warning: trim() expects parameter 1 to be string, array given | magento/module-catalog-search #33586

Closed
@Morgy93

Description

@Morgy93

Preconditions (*)

  • Magento 2.4.2
  • PHP 7.4

Steps to reproduce (*)

Pass an array to any advanced search string input
For example: /catalogsearch/advanced/result/?name[]=error

Expected result (*)

It should not throw an unhandled error.

Actual result (*)

Warning: trim() expects parameter 1 to be string, array given in vendor/magento/module-catalog-search/Model/Advanced.php on line 201

Trace:
#1 trim() called at [vendor/magento/module-catalog-search/Model/Advanced.php:201]
#2 Magento\CatalogSearch\Model\Advanced->addFilters() called at [vendor/magento/module-catalog-search/Controller/Advanced/Result.php:62]
#3 Magento\CatalogSearch\Controller\Advanced\Result->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#4 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#5 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php:51]
#6 Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin->aroundExecute() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#7 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#8 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callPlugins() called at [generated/code/Magento/CatalogSearch/Controller/Advanced/Result/Interceptor.php:23]
#9 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#10 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#11 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#12 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#13 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callPlugins() called at [generated/code/Magento/CatalogSearch/Controller/Advanced/Result/Interceptor.php:32]
#14 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:186]
#15 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:118]
#16 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#17 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#18 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
#19 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#20 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:75]
#21 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#22 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#23 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#24 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#25 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:263]
#26 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:29]

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

  • 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: SearchComponent: 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: doneReported on 2.4.2Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions