Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.11.8.1 explode() passing null to parameter #2 ($string) of type string is deprecated error on first search #3335

Closed
Tomasz-Silpion opened this issue Jul 24, 2024 · 1 comment

Comments

@Tomasz-Silpion
Copy link

Preconditions

Magento Version : CE 2.4.7

ElasticSuite Version : 7.17.9

Environment : Production

Steps to reproduce

  1. Upgrade elasticsuite from 2.11.8 to 2.11.8.1
  2. Search for any item

Expected result

  1. Search results should appear normally

Actual result

  1. Fatal error is displayed explode() passing null to parameter #2 ($string) of type string is deprecated error

The issue is caused by 14c08fc upgrade. After enforcing VirtualRootCategory as string:

diff --git a/Model/Rule.php b/Model/Rule.php
index 1dc3845..5af5473 100644
--- a/Model/Rule.php
+++ b/Model/Rule.php
@@ -433,7 +433,7 @@ class Rule extends \Smile\ElasticsuiteCatalogRule\Model\Rule implements VirtualR
         // -       - Category C (virtual with category B as root)
         // When you compute the rule of the category A you do not need to compute the rule of the category C
         // as all the product will be there.
-        if ($rootCategory && array_intersect(explode('/', $rootCategory->getPath()), $excludedCategories)) {
+        if ($rootCategory && array_intersect(explode('/', (string) $rootCategory->getPath()), $excludedCategories)) {
             return null;
         }

I'm not able to reproduce the issue even after reverting my change.

Tomasz-Silpion added a commit to lcbrq/magento2-elasticsuite that referenced this issue Jul 24, 2024
@PierreGauthier
Copy link
Contributor

Hello @Tomasz-Silpion
Thank you for reporting,
This issue will be fixed by : #3336
It is a bit different that your fix because we should have a category without path, I fixed the root cause too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants