Change record status: 
Project: 
Introduced in branch: 
7.x
Introduced in version: 
7.27
Description: 

The return value of ajax_get_form() changed slightly in Drupal 7.27. Before, an array containing $form, $form_state, $form_id, and $form_build_id was returned from this function. As of Drupal 7.27, $commands is returned as the fifth element of this list.

Typically this function is used by custom Ajax page callbacks provided by modules (i.e., page callbacks whose hook_menu() entry includes the line 'delivery callback' => 'ajax_deliver').

In order for your custom Ajax callback to work correctly in all cases when using Drupal 7.27 (in particular when anonymous users are interacting with the form and the page is being cached), you must change your code to use the provided $commands array as a starting point (and add your own Ajax commands to the end of it).

For example, a custom Ajax form page callback function might have looked like this:

function mymodule_ajax_page_callback() {
  list($form, $form_state) = ajax_get_form();

  // Process user input. $form and $form_state are modified in the process.
  drupal_process_form($form['#form_id'], $form, $form_state);

  $commands = array();
  $commands[] = ajax_command_alert(t('Hello world'));
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}

In order to make it compatible with the page cache for anonymous users in Drupal 7.27, the function needs to be changed as follows:

function mymodule_ajax_page_callback() {
  list($form, $form_state, $form_id, $form_build_id, $commands) = ajax_get_form();

  // Process user input. $form and $form_state are modified in the process.
  drupal_process_form($form['#form_id'], $form, $form_state);

  $commands[] = ajax_command_alert(t('Hello world'));
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done