bug:

function _batch_finished() {
// [...] here $batch is always NULL
    // Let drupal_redirect_form handle redirection logic.
    $form = isset($batch['form']) ? $batch['form'] : array();
    if (empty($_batch['form_state']['rebuild']) && empty($_batch['form_state']['storage'])) {
      drupal_redirect_form($form, $redirect);
    }

Fix:

function _batch_finished() {
// [...]
    // Let drupal_redirect_form handle redirection logic.
    $form = isset($_batch['form']) ? $_batch['form'] : array();
    if (empty($_batch['form_state']['rebuild']) && empty($_batch['form_state']['storage'])) {
      drupal_redirect_form($form, $redirect);
    }

As can be seen, since $batch is always empty, it sends an empty array to drupal_redirect_form instead of the form array, o $form['#redirect'] doesn't work.

CommentFileSizeAuthor
#1 drupal_862846_batch.patch527 byteshefox

Comments

hefox’s picture

Title: Batch ignore #redirect » Batch ignores #redirect due to checking undefined $batch instead of $_batch
Status: Active » Needs review
StatusFileSize
new527 bytes
darol100’s picture

Issue summary: View changes
Status: Needs review » Needs work
Issue tags: +Needs issue summary update

It's unclear to me what you are trying to solve. Can you provide, update the issue summary with exactly what the issue intends to fix.

hefox’s picture

Issue summary: View changes
Status: Needs work » Needs review

Okay, I added an additional sentance, but it's in the title also -- $form['#redirect'] doesn't work because $form is never passed in.

darol100’s picture

Status: Needs review » Reviewed & tested by the community

Even thought this patch is 3 years old still apply. I have tested it out and seem that it works.

Status: Reviewed & tested by the community » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.