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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DougKress’s picture

Title: Taxonomy term cache prohibits term update & load in same page load » Patch for DRUPAL-6
Version: 5.7 » 6.x-dev
FileSize
1.18 KB

This patch should work for Drupal 6.

Anonymous’s picture

Title: Patch for DRUPAL-6 » Taxonomy term cache prohibits term update & load in same page load
Status: Active » Needs review

Resetting 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?

DougKress’s picture

Yes - and thanks for updating the title.

Anonymous’s picture

Doug can you please provide a patch and test for D7?

catch’s picture

Version: 6.x-dev » 7.x-dev
Status: Needs review » Needs work

Code hasn't changed in Drupal 7 so needs fixing there first.

DougKress’s picture

It 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!

catch’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs work » Needs review

Yep. #5 is outdated. Moving back to 6.

johnv’s picture

Please 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.

Status: Needs review » Needs work

The last submitted patch, taxonomy_node_get_terms_20100904.patch, failed testing.

johnv’s picture

Status: Needs work » Needs review
FileSize
1.09 KB

new version of patch in #8.

Status: Needs review » Needs work

The last submitted patch, taxonomy_node_get_terms_20101105.patch, failed testing.

johnv’s picture

Title: Taxonomy term cache prohibits term update & load in same page load » Taxonomy term cache: grows unlimitedly and prohibits term update & load in same page load
FileSize
1.06 KB

new (unix-style) version of patch in #8, #10.

johnv’s picture

Status: Needs work » Needs review

set for test-queue

Status: Needs review » Needs work

The last submitted patch, taxonomy_node_get_terms_20101108.patch, failed testing.

johnv’s picture

Status: Needs work » Needs review
FileSize
1.06 KB

reposting

Status: Needs review » Needs work

The last submitted patch, taxonomy_node_get_terms_20101108.patch, failed testing.

johnv’s picture

Status: Needs work » Needs review
FileSize
1.07 KB

just keep trying..

Status: Needs review » Needs work

The last submitted patch, taxonomy_node_get_terms_20101108.patch, failed testing.

liquidcms’s picture

Priority: Normal » Major

just stumbled upon this; simpler way to say this i think is:

can't set tax on a node and then have a following node_load/node_save pair later in the same page load

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

liquidcms’s picture

killed 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.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.