Hey,

I'm getting this error when I try to run drush sapi-i [index name]:

Argument 5 passed to _search_api_batch_indexing_callback() must be of the type array, object given search_api.module:2700

Tried investigating it and I see the $context arg to have been passed with this value:

DrushBatchContext Object                                                                                                        [notice]
(
    [storage:ArrayObject:private] => Array
        (
            [sandbox] => Array
                (
                )

            [results] => Array
                (
                )

            [finished] => 1
            [message] =>
        )

)

Any ideas?

Comments

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new901 bytes

A curious problem, thanks for reporting it! It seems that in your case (maybe due to a new version?), Drush uses an array object instead of a normal array for the context parameter. Since the API docs don't specify that $context is an array in any stricter way, I guess that's allowed usage (though probably not a good idea). So we should probably fix our function callback to work with an array object as well.

Patch attached, please test!

dsdeiz’s picture

Status: Needs review » Reviewed & tested by the community

Sweet! Works on my end.

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Good to hear, thanks for testing!
Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.