title: Drupal 6 batch not executing
body: <p>Anyone able to offer some ideas on this? Basically the module I'm building has a form (as per function_email_solicitors_compose), and on submission we obviously route to form_emails_solicitors_compose_submit. Here I define a batch in $batch, and batch_set the aforementioned batch. The drupal documentation says I don't need to run batch_process() if it's called from within a form_submit, which this is, but I've tried with and without. All tests have shown that it gets as far as defining the batch but never goes any further than that. email_solicitors_batch_iteration never runs. Any ideas?</p>
  
  <p>As an additional bit of info, batch_get then returns the following:</p>
  
  <blockquote>
  <pre><code>Array
  (
      [sets] =&gt; Array
          (
              [0] =&gt; Array
                  (
                      [sandbox] =&gt; Array
                          (
                          )
  
                      [results] =&gt; Array
                          (
                          )
  
                      [success] =&gt; 
                      [title] =&gt; Emailing.
                      [operations] =&gt; Array
                          (
                              [0] =&gt; Array
                                  (
                                      [0] =&gt;
  </code></pre>
    
    <p>email_solicitors_batch_iteration
                                            [1] => Array
                                                (
                                                    [0] => 
                                                    [1] => 
                                                )</p>
  
  <pre><code>                                )
  
                          )
  
                      [finished] =&gt; my_finished_callback
                      [init_message] =&gt; Initializing.&lt;br/&gt;&amp;nbsp;
                      [progress_message] =&gt; Remaining
  </code></pre>
    
    <p>@remaining of @total.
                            [error_message] => An error has
    occurred.
                            [total] => 1
                        )</p>
  
  <pre><code>        )
  
  )
  </code></pre>
  </blockquote>
  
  <p>The code:</p>
  
  <pre><code>function email_solicitors_compose(){
      $form['email_solicitors_subject'] = array(
          '#type' =&gt; 'textfield',
          '#title' =&gt; t('Subject'),
          '#description' =&gt; t('Enter the subject of your email'),
          '#default_value' =&gt; 'Subject',
          '#size' =&gt; 30
      );
      $form['email_solicitors_message'] = array(
          '#type' =&gt; 'textarea',
          '#title' =&gt; t('Message'),
          '#description' =&gt; t('Write your message here. &lt;strong&gt;Please note that we will automatically add "Dear #name", which will be personalised to the solicitor.&lt;/strong&gt;'),
          '#default_value' =&gt; '',
      );
      $form['email_solicitors_submit'] = array(
          '#type' =&gt; 'submit',
          '#title' =&gt; t('Submit'),
          '#description' =&gt; t('Sumbit this form.'),
          '#default_value' =&gt; 'Submit',
      );
      return $form;
  }//function email_solicitors_compose
  
  
  function email_solicitors_compose_submit($form_state)
  {
      $batch = array(
          'title' =&gt; t('Sending emails to solicitors'),
          'operations' =&gt; array(
              array('email_solicitors_batch_iteration', array())
          ), 
          'finished' =&gt; 'email_solicitors_batch_finished', //run this when we're finished
          'init_message' =&gt; t('Preparing to send emails'), //initialisation message
          'progress_message' =&gt; t('Sent @current out of @total messages.'),
          'error_message' =&gt; t('Sorry, something went wrong when sending emails.'),
      );// create batch array
      $info=print_r($batch,TRUE);
      drupal_set_message($info);
      batch_set($batch);
      batch_process();
  }//function email_solicitors_compose_submit
  
  
  function email_solicitors_batch_iteration(&amp;$context)
  {
      // Initialize sandbox the first time through.
      if (!isset($context['sandbox']['progress'])) {
          $context['sandbox']['progress'] = 0;
          $context['sandbox']['current_user_id'] = 0;
          $context['sandbox']['max'] = db_result(db_query('SELECT COUNT(DISTINCT field_solicitor_email_value) FROM content_type_solicitor'));
      }
      $comment="On item ".$context['sandbox']['progress'];
      drupal_set_message ($comment);
  }//function email_solicitors_batch_iteration
  
  function email_solicitors_batch_finished (&amp;$context)
  {
      die ('woohoo we finished');
  }
  </code></pre>