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

FPC related PHP warning (might block) when deleting an Optimizer with search terms limitations #1583

Closed
rbayet opened this issue Oct 16, 2019 · 0 comments
Assignees
Labels

Comments

@rbayet
Copy link
Collaborator

rbayet commented Oct 16, 2019

Preconditions

Magento Version : EE 2.3.0, 2.3.2

ElasticSuite Version : 2.8.2 and 2.8.x

Environment : Developer

Third party modules : N/A

Steps to reproduce

  1. Make sure to enable the default FPC in admin
  2. Create an optimizer applicable on the catalog product search container and with search query terms limitations
  3. From the optimizers grid, try to delete the optimizer

Expected result

  1. The optimizer should be deleted, with a success notice being displayed

Actual result

  1. The browser redirects to the optimizer edit screen and an error notice is display with the error message "Warning: Illegal string offset 'id' in /var/www/ee232/vendor/smile/elasticsuite/src/module-elasticsuite-catalog-optimizer/Model/Optimizer/Limitation/Identities.php on line 115"

The issue seems to be that the Identities class expects $data['quick_search_container']['query_ids'] to be an array of dynamic rows as in \Smile\ElasticsuiteCatalogOptimizer\Model\Optimizer\Limitation\SaveHandler::getQueryIdsLimitation but this is not consistent when simply deleting the optimizer from the grid.

Additionally, Identities is not consistent either with the side effects the ReadHandler perform in \Smile\ElasticsuiteCatalogOptimizer\Model\Optimizer\Limitation\ReadHandler::getSearchQueryLimitation so I'm a bit lost there.

Anyway, if there are cases (from the edit form ?) where $data['quick_search_container']['query_ids'] is indeed an array of array, a check should be added in the loop to extract the query id either from $query or $query['id'] :

        if (!empty($data['quick_search_container']['query_ids'])) {
            foreach ($data['quick_search_container']['query_ids'] as $query) {
                $queryIds[] = $query['id'];
            }
        }
@rbayet rbayet self-assigned this Oct 16, 2019
rbayet added a commit to rbayet/elasticsuite that referenced this issue Oct 16, 2019
from grid with FPC active.
Minor cosmetic changes on the read handler.
@rbayet rbayet added the bug label Oct 16, 2019
@rbayet rbayet closed this as completed in 2881934 Oct 17, 2019
rbayet added a commit that referenced this issue Oct 17, 2019
…letion

Fixes #1583 deleting optimizer w/query limitation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant