I have installed Smile_Elasticsearch extension.It is working fine with the default mode but when I enabled developer mode it is showing an error.

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 app/code/Smile/ElasticsuiteVirtualCategory/Model/Layer/Filter/Category.php on line 150

Please see attached screenshot.

enter image description here

Technology Detail's:

  • Magento version: 2.3
  • Smile Elasticsearch version: 2.7.0 (which is compatible with Magento 2.3)
  • Installed Elasticsearch version: 5.6.15 (which is compatible with magento 2.3)
  • PHP version: 7.1

So, Please let me know how can I fix this error? Your help would be appreciated. Thanks in advance.!!!


2 Answers 2


The error you are seeing in the file app/code/Smile/ElasticsuiteVirtualCategory/Model/Layer/Filter/Category.php suggests that there is an issue with a callback function that is being called in the file. This error is typically caused when the callback function is not a valid class or object.

To resolve this issue, you can try the following:

  1. Check that the file app/code/Smile/ElasticsuiteVirtualCategory/Model/Layer/Filter/Category.php exists and that it is not corrupted. If necessary, you can try downloading the extension again and reinstalling it.

  2. Check that the class Smile\ElasticsuiteVirtualCategory\Model\Layer\Filter\Category exists and that it is being loaded properly. You can do this by adding the following code at the beginning of the file app/code/Smile/ElasticsuiteVirtualCategory/Model/Layer/Filter/Category.php

    die('Class: ' . get_class($this));

If the class is not being loaded properly, you may need to check your Magento configuration or contact the extension developer for further assistance.


Here parameter 1 [$virtualRule, $callback] must be an array to callback these functions.

Here is the solution.

Goto line around 151 to 156 /module-elasticsuite-virtual-category/Model/Layer/Filter/Category.php

if ($data === false) {
    $virtualRule = $category->getVirtualRule();
    //$data = call_user_func_array([$virtualRule, $callback], [$category]);
    $cacheData = serialize($data);
    $this->cache->save($cacheData, $cacheKey, [\Magento\Catalog\Model\Category::CACHE_TAG]);

Change to this:

if ($data === false) {
    $virtualRule = $category->getVirtualRule();
    $data = call_user_func_array(array[$virtualRule, $callback], [$category]);
    $cacheData = serialize($data);
    $this->cache->save($cacheData, $cacheKey, [\Magento\Catalog\Model\Category::CACHE_TAG]);

Reference: https://www.php.net/manual/en/function.call-user-func.php

  • You just changed the array form from the new [] to the old array() version, so in fact nothing will change Oct 18, 2022 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.