As shown in the title, an error message appears in our system.log file indicating that an array is being passed to strpos() which expects a string. This has been known to happen when a product attribute filter is passed as an array rather than a string value. The product grid is properly displaying products, however the filters are not appearing. This is happening on Magento 2.3.2 and has been reported on other versions as can be found on stackoverflow.


report.CRITICAL: Warning: strpos() expects parameter 1 to be string, array given in vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php on line 152 [] []
report.CRITICAL: The "catalog.leftnav" block threw an exception, and it can't be rendered. [] []

++ if (is_string($content) && strpos($content, '
i've tested the fix on 2.3.3-p1 and it seems to work
Hi @ngreimel-lt. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.3-develop instance - upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@ngreimel-lt do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
@magento give me 2.3-develop instance
Hi @ngreimel-lt. Thank you for your request. I'm working on Magento 2.3-develop instance for you
Hi @ngreimel-lt, here is your Magento instance.
Admin access: https://i-25438-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
Confirmed present https://i-25438-2-3-develop.instances.magento-community.engineering/apparel.html?size[]=4&size[]=5
Proposed patch:
diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php
index 46e4b665cab..56d73422a68 100644
--- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php
+++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php
@@ -143,13 +143,15 @@ class Table extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
/**
* Get a text for option value
*
- * @param string|integer $value
+ * @param array|string|integer $value
* @return array|string|bool
*/
public function getOptionText($value)
{
$isMultiple = false;
- if (strpos($value, ',') !== false) {
+ if (is_array($value)) {
+ $isMultiple = true;
+ } elseif (strpos($value, ',') !== false) {
$isMultiple = true;
$value = explode(',', $value);
}
Hi @edenduong. 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:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
2.3-develop branch@magento give me 2.3-develop instance to deploy test instance on Magento infrastructure. 2.3-develop branch, please, add the label Reproduced on 2.3.x.@magento I am working on it.
Hi @krishprakash. 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:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.3-develop instance
Hi @edenduong. Thank you for your request. I'm working on Magento 2.3-develop instance for you
Hi @edenduong, here is your Magento instance.
Admin access: https://i-25438-2-3-develop.instances.magento-community.engineering/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.
Hi @engcom-Echo. 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:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 5. Add label Issue: Confirmed once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
:white_check_mark: Confirmed by @engcom-Echo
Thank you for verifying the issue. Based on the provided information internal tickets MC-29280 were created
Issue Available: @engcom-Echo, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
Any update? We're having the same problem.
@rohit-wagento thank you for joining. Please accept team invitation here and self-assign the issue.
Hi @rohit-wagento. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.4-develop branchDetails
- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
@rohit-wagento Are you still working on the issue? Otherwise I have the following fix for it and could open a PR if that's okay:
(in Magento_Theme module:)
diff a/Controller/Result/JsFooterPlugin.php b/Controller/Result/JsFooterPlugin.php
--- a/Controller/Result/JsFooterPlugin.php
+++ b/Controller/Result/JsFooterPlugin.php
@@ -40,7 +40,10 @@
public function beforeSendResponse(Http $subject)
{
$content = $subject->getContent();
+ if ($content === null) {
+ return;
+ }
$script = [];
if (strpos($content, '</body') !== false) {
if ($this->scopeConfig->isSetFlag(
self::XML_PATH_DEV_MOVE_JS_TO_BOTTOM,
I don't think @ngreimel-lt 's patch above is related to the issue, but maybe I'm missing something
Hello @Parakoopa in Magento 2.4-dev it is fixed as:
https://github.com/magento/magento2/commit/ff1aa7e5f0a37bf13c9c466c50297843bd949d47
-- if (strpos($content, ' ++ if (is_string($content) && strpos($content, '
i've tested the fix on 2.3.3-p1 and it seems to work
Just wanted to chime in here, since I've landed on this thread from Google after having encountered the error on a site I'm working on.
I have a controller that returns an instance of Magento\Framework\Controller\Result\Json. If I don't call setData() before returning the result object, I get the following error:
Fatal error: Uncaught TypeError: strpos() expects parameter 1 to be string, null given in /Users/pbice/dev/magento/vendor/magento/module-theme/Controller/Result/JsFooterPlugin.php:44
Stack trace:
#0 /Users/pbice/dev/magento/vendor/magento/module-theme/Controller/Result/JsFooterPlugin.php(44): strpos(NULL, '</body')
#1 /Users/pbice/dev/magento/vendor/magento/framework/Interception/Interceptor.php(121): Magento\Theme\Controller\Result\JsFooterPlugin->beforeSendResponse(Object(Magento\Framework\App\Response\Http\Interceptor))
#2 /Users/pbice/dev/magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Response\Http\Interceptor->Magento\Framework\Interception\{closure}()
#3 /Users/pbice/dev/magento/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(117): Magento\Framework\App\Response\Http\Interceptor->___callPlugins('sendResponse', Array, Array)
#4 /Users/pbice/dev/m2_ebscomags/vendor/magento/framework/App/Bootstrap.php(262): Magento\Framework\App\Resp in /Users/pbice/dev/magento/vendor/magento/module-theme/Controller/Result/JsFooterPlugin.php on line 44
Obviously the fix on my end is very simple, and I'm not entirely sure whether this is a bug, but I figured I would share in case it is. It would be nice to be able to use the Json result type without having to always send a payload with the response, which is necessary to prevent the above error, but the workaround isn't anything I feel is worth complaining about.
Hi @engcom-Delta. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.2.4-develop branch@magento give me 2.4-develop instance to deploy test instance on Magento infrastructure. 2.4-develop branch, please, add the label Reproduced on 2.4.x.@magento give me 2.4-develop instance
Hi @engcom-Delta. Thank you for your request. I'm working on Magento instance for you.
Hi @engcom-Delta, here is your Magento Instance: https://c69c4152976fc84d24ac9dd0869e23ca-2-4-develop.instances.magento-community.engineering
Admin access: https://c69c4152976fc84d24ac9dd0869e23ca-2-4-develop.instances.magento-community.engineering/admin_dec2
Login: f78c1a06
Password: f6ce354581d6
@Parakoopa , @p810 Issue is not reproducible on 2.4-develop and on the latest composer version 2.4.1
Result:

Please feel free to comment, reopen or create new ticket according to the Issue reporting guidelines
if you are still facing this issue on the latest 2.4-develop branch. Thank you for collaboration.
Most helpful comment
Hello @Parakoopa in Magento 2.4-dev it is fixed as:
https://github.com/magento/magento2/commit/ff1aa7e5f0a37bf13c9c466c50297843bd949d47
-- if (strpos($content, '