Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#4 | batch_drupal_execute_example.patch | 1.6 KB | yched |
batch_drupal_execute.patch | 903 bytes | yched | |
Comments
Comment #1
moshe weitzman CreditAttribution: moshe weitzman commentedwhat is easiest way to test this?
Comment #2
chx CreditAttribution: chx commentedThe 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
Comment #3
yched CreditAttribution: yched commentedActually, 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.
Comment #4
yched CreditAttribution: yched commentedOK, 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.
Comment #5
yched CreditAttribution: yched commentedbump ?
Comment #6
profix898 CreditAttribution: profix898 commentedPatch still applies and cleanly solves the problem. I think this is RTBC.
Comment #7
Gábor HojtsyThanks, committed!
Comment #8
(not verified) CreditAttribution: commented