Skip to content

strlen() expects parameter 1 to be string, array given | magento/module-catalog-search #33589

Closed
@Morgy93

Description

@Morgy93

Preconditions (*)

  • Magento 2.4.2
  • PHP 7.4

Steps to reproduce (*)

  1. Go to /catalogsearch/advanced/result/?price[from][]=1&price[to]=1
  2. On trying to access above URL from front-end, "There has been an error processing your request" error message is getting displayed on UI:
    http://magento2.4.local/catalogsearch/advanced/result/?price[from][]=1&price[to]=1
    image

Expected result (*)

It should not throw an unhandled error.

Actual result (*)

Exception #0 (Exception): Warning: strlen() expects parameter 1 to be string, array given in vendor/magento/module-catalog-search/Model/Advanced.php on line 380

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

Issue 2: strpos() expects parameter 1 to be string, array given | magento/module-eav #33588
Steps to reproduce:

  1. Admin: Stores -> Attributes -> Product - > Add New Attribute /Choose existing attribute ex: color
    Input Type should be: Dropdown
    Storefront Properties: Use in Search: Yes, Visible in Advanced Search: Yes
  2. Front-end - Go to http://yourmagentostore.com/catalogsearch/advanced/result/?attributename[][error]=1
    Ex: https://magento2.4.local/catalogsearch/advanced/result/?test_data[][error]=1
    Issue: There has been an error processing your request Error message is getting displayed
    Note: There is no issue with Text Attribute. URL is working for Text attribute. Issue is observed for dropdown attribute.

Magentoroot/var/log/exception.log:

Exception #0 (Exception): Warning: strpos() expects parameter 1 to be string, array given in vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php on line 152

#1 strpos() called at [vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php:152]
#2 Magento\Eav\Model\Entity\Attribute\Source\Table->getOptionText() called at [vendor/magento/module-catalog-search/Model/Advanced.php:404]
#3 Magento\CatalogSearch\Model\Advanced->getPreparedSearchCriteria() called at [vendor/magento/module-catalog-search/Model/Advanced.php:206]
#4 Magento\CatalogSearch\Model\Advanced->addFilters() called at [vendor/magento/module-catalog-search/Controller/Advanced/Result.php:62]
#5 Magento\CatalogSearch\Controller\Advanced\Result->execute() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#6 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#7 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php:51]
#8 Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin->aroundExecute() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#9 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#10 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callPlugins() called at [generated/code/Magento/CatalogSearch/Controller/Advanced/Result/Interceptor.php:23]
#11 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#12 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#13 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#14 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#15 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->___callPlugins() called at [generated/code/Magento/CatalogSearch/Controller/Advanced/Result/Interceptor.php:32]
#16 Magento\CatalogSearch\Controller\Advanced\Result\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:186]
#17 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:118]
#18 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#19 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#20 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:99]
#21 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#22 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:71]
#23 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#24 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#25 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:23]
#26 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#27 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:263]
#28 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

Component: UrlFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: 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 branch

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions