Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
761 stars 340 forks source link

ES ^2.6 - Elastic 6.x | Warning: call_user_func_array() expects parameter 1 to be a valid callback #1085

Closed Streetec closed 5 years ago

Streetec commented 6 years ago

Preconditions

Magento Version : 2.2.5 CE ElasticSuite Version : ^2.6 Environment : Developer

Steps to reproduce

  1. Install ElasticSuite ^2.6 & ElasticSearch 6.X
  2. Index everything
  3. Open a category

Expected result

  1. Category shows as usual and works

Actual result

1 exception(s): Exception #0 (Exception): Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php on line 153

Exception #0 (Exception): Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php on line 153

0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'call_userfunc...', '/usr/www/users/...', 153, Array)

1 /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php(153): call_user_func_array(Array, Array)

2 /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php(130): Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category->loadUsingCache('getCategorySear...')

3 /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php(104): Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category->getFilterQuery()

4 /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/Layer/Filter/Category.php(98): Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category->applyCategoryFilterToCollection(Object(MGS\Mpanel\Model\Category\Interceptor))

5 /usr/www/users/nullnp/2018/vendor/magento/module-layered-navigation/Block/Navigation.php(67): Smile\ElasticsuiteCatalog\Model\Layer\Filter\Category->apply(Object(Magento\Framework\App\Request\Http))

6 /usr/www/users/nullnp/2018/vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Block/Navigation.php(173): Magento\LayeredNavigation\Block\Navigation->_prepareLayout()

7 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Element/AbstractBlock.php(272): Smile\ElasticsuiteCatalog\Block\Navigation->_prepareLayout()

8 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Layout/Generator/Block.php(150): Magento\Framework\View\Element\AbstractBlock->setLayout(Object(Magento\Framework\View\Layout\Interceptor))

9 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Layout/GeneratorPool.php(80): Magento\Framework\View\Layout\Generator\Block->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))

10 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Layout.php(344): Magento\Framework\View\Layout\GeneratorPool->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))

11 /usr/www/users/nullnp/2018/generated/code/Magento/Framework/View/Layout/Interceptor.php(89): Magento\Framework\View\Layout->generateElements()

12 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()

13 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Page/Builder.php(55): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()

14 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Page\Builder->generateLayoutBlocks()

15 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Page/Config.php(197): Magento\Framework\View\Layout\Builder->build()

16 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Page/Config.php(509): Magento\Framework\View\Page\Config->build()

17 /usr/www/users/nullnp/2018/vendor/magento/framework/View/Page/Config.php(467): Magento\Framework\View\Page\Config->getElementAttribute('body', 'class')

18 /usr/www/users/nullnp/2018/app/code/MGS/Mpanel/Controller/Category/View.php(185): Magento\Framework\View\Page\Config->addBodyClass('page-products')

19 /usr/www/users/nullnp/2018/generated/code/MGS/Mpanel/Controller/Category/View/Interceptor.php(24): MGS\Mpanel\Controller\Category\View->execute()

20 /usr/www/users/nullnp/2018/vendor/magento/framework/App/Action/Action.php(107): MGS\Mpanel\Controller\Category\View\Interceptor->execute()

21 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))

22 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(138): MGS\Mpanel\Controller\Category\View\Interceptor->___callParent('dispatch', Array)

23 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(153): MGS\Mpanel\Controller\Category\View\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

24 /usr/www/users/nullnp/2018/generated/code/MGS/Mpanel/Controller/Category/View/Interceptor.php(39): MGS\Mpanel\Controller\Category\View\Interceptor->___callPlugins('dispatch', Array, Array)

25 /usr/www/users/nullnp/2018/vendor/magento/framework/App/FrontController.php(55): MGS\Mpanel\Controller\Category\View\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

26 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))

27 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)

28 /usr/www/users/nullnp/2018/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

29 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))

30 /usr/www/users/nullnp/2018/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

31 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))

32 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

33 /usr/www/users/nullnp/2018/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)

34 /usr/www/users/nullnp/2018/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

35 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Http->launch()

36 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\Http\Interceptor->___callParent('launch', Array)

37 /usr/www/users/nullnp/2018/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception{closure}()

38 /usr/www/users/nullnp/2018/generated/code/Magento/Framework/App/Http/Interceptor.php(26): Magento\Framework\App\Http\Interceptor->___callPlugins('launch', Array, Array)

39 /usr/www/users/nullnp/2018/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()

40 /usr/www/users/nullnp/2018/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

41 {main}

Edit

After diableing the VirtualCatalog module everything works like expected.

romainruaud commented 6 years ago

Hello,

can you check with a debugger (or by logging it), what is the value of $virtualRule variable on line 152 of the file where the error is thrown ?

Regards

bluscience commented 6 years ago

I'm receiving the some error with Magento 2.2.6 and ES 6.2.4. The $virtualRule has the following value:

{"type":"Smile\\ElasticsuiteVirtualCategory\\Model\\Rule\\Condition\\Combine","attribute":null,"operator":null,"value":"1","is_value_processed":null,"aggregator":"all"}

romainruaud commented 6 years ago

Hmmm ... I have an idea. Are you using Flat Categories ?

romainruaud commented 6 years ago

I tested myself and have no issues with flat categories either.

However, can you give me the output of :

SQL Query : select * from eav_attribute where attribute_code="virtual_rule";

command : composer info | grep smile

Streetec commented 6 years ago

composer info | grep smile

smile/elasticsuite                                2.6.2               Magento 2 merchandising and search engine built on ElasticSearch

select * from eav_attribute where attribute_code="virtual_rule"; sql result

However, after updating to ES 2.6.2 everything seems to work but i get a new error on the Catalog Admin page which I will describe on a new Error report

romainruaud commented 5 years ago

I consider this one as resolved according to your last reply.

Best regards