Join us at DrupalCon Singapore from 9-11 December 2024, for three exciting days of Drupal content, training, contributions, networking, and the inaugural DrupalCon Splash Awards! Be part of this landmark event as we celebrate and expand Drupal's impact across Asia.
Create a module and enable it. Create two update functions, _1 and _2, and declare them in most-recent first order:
function mymod_update_2() {
drupal_set_message('update 2');
}
function mymod_update_1() {
drupal_set_message('update 1');
}
Run update.php and see the output. Notice that only update_2() runs.
Initial patch against 5.x attached but it applies to HEAD. This patch needs tests and, IMHO, should then be back-ported to 6.x and 5.x.
Comment | File | Size | Author |
---|---|---|---|
#5 | install-update-order-246143-3.patch | 783 bytes | Damien Tournoud |
#3 | install-update-order-246143-3.patch | 858 bytes | floretan |
install-update-order.patch | 512 bytes | bjaspan |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedI'm not sure there are any real-world consequences for that bug, so that's not critical. Any way, I can confirm that bugs. All updates functions in install.php and update.php expects the result of
drupal_get_schema_versions()
to be sorted, while nothing in thedrupal_get_schema_versions()
contract guarantees that.I have not tested the patch. On review, it looks good, but the change in the behavior of the function (ie. the results will always be ordered) should be documented in its doxygen comment.
Comment #2
bjaspan CreditAttribution: bjaspan commentedThe real-world consequence is that foo_update_1() will never be run and foo_update_2() will be. That's bad and complete violates the specification for update functions.
Comment #3
floretan CreditAttribution: floretan commentedMention the sorting in the doxygen comment.
Comment #4
Damien Tournoud CreditAttribution: Damien Tournoud commentedTested and confirmed to work on a dummy module.
No module was ever broken due to this bug, because all follows the sound convention of putting updates stages in order, so demoting this to normal.
Comment #5
Damien Tournoud CreditAttribution: Damien Tournoud commentedRerolled for head. Trivial fix that solves a confirmed problem, marked as RTBC.
Comment #6
dries CreditAttribution: dries commentedCommitted to CVS HEAD and DRUPAL-6. Might have to go into DRUPAL-5 too.
Comment #7
drummCommitted to 5.x.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.