Reported by chx : when drupal_execute is used inside a batched function call, the batch processing breaks completely.
(when processing the programmatic form, FAPI checks if batches were set in form handlers, but in fact catches the batch
being currently processed and attempts to re-process it).

Simple fix attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

moshe weitzman’s picture

what is easiest way to test this?

chx’s picture

The issue revealed itself when i tried to drupal_execute the menu edit menu form in an upgrade -- the upgrade froze. Try doing a multipart upgrade and drupal_execute inside

yched’s picture

Actually, there should be no need to set up a multi-step upgrade.
just add a dummy system_update_n that simply drupal_executes a stupid form ('OK' button, drupal_set_message('foobar') in the form submit handler).

I'm away from home these days, and can't easily wrap up sample code, unfortunately.

yched’s picture

OK, here is an *example* (not for actual core inclusion :-) ) patch for system.module, that adds dummy updates to illustrate the bug.
The actual patch to review / commit is in the original post.

yched’s picture

bump ?

profix898’s picture

Status: Needs review » Reviewed & tested by the community

Patch still applies and cleanly solves the problem. I think this is RTBC.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed!

Anonymous’s picture

Status: Fixed » Closed (fixed)