Hello fellow developers,
In fixing an error related to the
notifications module in Drupal 5 and 6, I came across an unexpected
behavior that merits discussion, and possibly a fix in Drupal 7, as the
functionality doesn't appear to have changed. The immediate issue is on
pages such as the node edit form when using the notifications module
with immediate sending, but applies in many other places. It occurs
when these actions occur sequentially, which is quite commonplace:
1: a node_load is performed for [nid]
2: a node_save is performed on the same [nid], updating the database accordingly
3: either during the nodeapi('update') hook or afterwards, a node_load is performed on [nid]
When number 3 occurs, it will load the OLD node, prior to the
update, because the node will have been CACHED in the static variable
of the node_load function.
------------------------------