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.
This is primarily an issue with testing. The function taxonomy_node_get_terms caches terms by nid/key. This cache has no reset.
Normally, with a typical form post, this isn't an issue. However, if for some reason you are updating terms programatically, node_load will not reflect the correct terms within the same page load.
Comment | File | Size | Author |
---|---|---|---|
#17 | taxonomy_node_get_terms_20101108.patch | 1.07 KB | johnv |
#15 | taxonomy_node_get_terms_20101108.patch | 1.06 KB | johnv |
#12 | taxonomy_node_get_terms_20101108.patch | 1.06 KB | johnv |
#10 | taxonomy_node_get_terms_20101105.patch | 1.09 KB | johnv |
#8 | taxonomy_node_get_terms_20100904.patch | 1.31 KB | johnv |
Comments
Comment #1
DougKress CreditAttribution: DougKress commentedThis patch should work for Drupal 6.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedResetting title.
So that I understand, is the patch with the original post for 5.x while the patch in the subsequent comment for 6.x?
Comment #3
DougKress CreditAttribution: DougKress commentedYes - and thanks for updating the title.
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedDoug can you please provide a patch and test for D7?
Comment #5
catchCode hasn't changed in Drupal 7 so needs fixing there first.
Comment #6
DougKress CreditAttribution: DougKress commentedIt appears that Drupal 7 doesn't need the patch, as it uses drupal_static, allowing reset from outside the function.
The patches are still good for 5 and 6, right?
EDIT: Apparently it's been a year since I last looked at this patch - yikes!
Comment #7
catchYep. #5 is outdated. Moving back to 6.
Comment #8
johnvPlease review the newly attached patch, since the current patch (in #1) doesn't clear the cache.
Attache file the same interface as #1, but has more cache-clearing features.
Comment #10
johnvnew version of patch in #8.
Comment #12
johnvnew (unix-style) version of patch in #8, #10.
Comment #13
johnvset for test-queue
Comment #15
johnvreposting
Comment #17
johnvjust keep trying..
Comment #19
liquidcms CreditAttribution: liquidcms commentedjust stumbled upon this; simpler way to say this i think is:
wow.. pretty messed up
i think more generally, and likely in d7/8 as well, a node load with reset should likely pass the reset to subsequent nodeapi calls
Comment #20
liquidcms CreditAttribution: liquidcms commentedkilled a kitten today because of this.. pretty bad core bug..
simply commented out static $terms line.. didn't see any other way to fix this.