https://www.drupal.org/node/2689939 removed the array type hinting for batch context from IndexBatchHelper, but there are a couple of other locations in search_api that this change needs to be made in so that drush commands run correctly.

We are seeing errors in TaskManager->processBatch():

TypeError: Argument 3 passed to Drupal\search_api\Task\TaskManager::processBatch() must be of the type array, object given, called in /var/www/pin_business/vendor/drush/drush/commands/core/drupal/batch.inc on line 163 in /var/www/pin_business/docroot/modules/contrib/search_api/src/Task/TaskManager.php on line 280 #0 /var/www/pin_business/vendor/drush/drush/commands/core/drupal/batch.inc(163): Drupal\search_api\Task\TaskManager->processBatch(Array, Array, Object(DrushBatchContext))
#1 /var/www/pin_business/vendor/drush/drush/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#2 /var/www/pin_business/vendor/drush/drush/includes/batch.inc(92): _drush_batch_command('10186')
#3 /var/www/pin_business/vendor/drush/drush/commands/core/drupal/update.inc(174): drush_batch_command('10186')
#4 /var/www/pin_business/vendor/drush/drush/commands/core/core.drush.inc(1222): _update_batch_command('10186')
#5 /var/www/pin_business/vendor/drush/drush/includes/command.inc(366): drush_core_updatedb_batch_process('10186')
#6 /var/www/pin_business/vendor/drush/drush/includes/command.inc(217): _drush_invoke_hooks(Array, Array)
#7 /var/www/pin_business/vendor/drush/drush/includes/command.inc(185): drush_command('10186')
#8 /var/www/pin_business/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(72): drush_dispatch(Array)
#9 /var/www/pin_business/vendor/drush/drush/includes/preflight.inc(68): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#10 /var/www/pin_business/vendor/drush/drush/drush.php(12): drush_main()
#11 {main}
TypeError: Argument 3 passed to Drupal\search_api\Task\TaskManager::processBatch() must be of the type array, object given, called in /var/www/pin_business/vendor/drush/drush/commands/core/drupal/batch.inc on line 163 in Drupal\search_api\Task\TaskManager->processBatch() (line 280 of /var/www/pin_business/docroot/modules/contrib/search_api/src/Task/TaskManager.php).

I also see type hinting for batch context in IndexTaskManager, but I have not personally seen that error get thrown. I will include a fix to that as a separate patch, to be merged at maintainers' discretion.

Comments

timcosgrove created an issue. See original summary.

timcosgrove’s picture

Removes array type hinting for batch context from TaskManager.

timcosgrove’s picture

Removes type hinting for batch context from IndexTaskManager. Again, noting that I have not actually seen this error out, so this is at maintainers' discretion.

drunken monkey’s picture

Status: Active » Fixed

Makes sense, didn't think of this anymore. Thanks!
Committed.

(In the future, please set issue status to "Needs review" after posting patches.)

Status: Fixed » Closed (fixed)

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