First thanks for this amazing module to make the batch work simpler.

This morning I received a bug report email from the web user. Here is the error information:

Performing Modify node taxonomy terms on selected rows...
An error has occurred.
Please continue to the error page

An error occurred. /en/batch?id=16&op=do
Fatal error: Cannot break/continue 1 level in /var/www/sites/all/modules/views_bulk_operations/views_bulk_operations.module on line 698

I am also waiting them to give me more details like how this happened, because I have not encountered issue before.

But, I check the line 698 in Ver6.10 and find following snippet:

  if (!$object) {
    $context['results']['log'][] = t('Skipped %action on @type id %oid.', array(
      '%action' => $operation['label'],
      '@type' => t($operation['type']),
      '%oid' => $oid,  
    ));
    continue;
  }

I wonder can we use 'return' to replace 'continue'?

  if (!$object) {
    $context['results']['log'][] = t('Skipped %action on @type id %oid.', array(
      '%action' => $operation['label'],
      '@type' => t($operation['type']),
      '%oid' => $oid,  
    ));
    //continue;
    return;
  }

Thanks

CommentFileSizeAuthor
#3 views_bulk_operations-1030574-v1.patch393 bytesmuhleder

Comments

thomasmuirhead’s picture

Hi there,

We're getting exactly the same error.

Did you try the change above? Did it work?

Thanks

Thomas

muhleder’s picture

That continue should almost certainly be a return. It looks like the code wasn't fully updated when (if?) the function was turned into a batch process.

The calling function is

  }
  if ($operation['aggregate'] != VBO_AGGREGATE_FORCED && $options['execution_type'] == VBO_EXECUTION_BATCH) {
    $operations = array();
    foreach ($objects as $num => $row) {
      $oid = $row->{$view->base_field};
      $operations[] = array('_views_bulk_operations_batch_process', array($oid, $row));
    }

    // Save the options in the session because Batch API doesn't give a way to 
    // send a parameter to the finished callback.

and continue would make sense if the code from _views_bulk_operations_batch_process() was actually contained in the foreach loop. In it's current state return; should have the same effect as continue; might have done in the past.

muhleder’s picture

StatusFileSize
new393 bytes

And here's a patch fwiw.

eric.chenchao’s picture

Yes, that works and thanks for reviewing:)

muhleder’s picture

Status: Active » Reviewed & tested by the community

Changing status to RTBC for review by maintainer.

rjbrown99’s picture

+1 same problem, patch works. Thanks.

infojunkie’s picture

Version: 6.x-1.10 » 6.x-1.x-dev

Thanks for the debugging and patch. Committed to latest dev.

infojunkie’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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