It seems that taxonomy terms are incorrectly affected to the 'Taxonomy upgrade extras' vocabulary in some cases.

As seen on the upgraded Drupal.org:

Both nodes are of the same type (forum).

It looks like this could be a new beta blocker.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Damien Tournoud’s picture

catch asked for the content of {term_node} for those nodes.

catch’s picture

Status: Active » Needs work
FileSize
1.37 KB

Here's a patch for what I think the bug is.

To test this, looks like we need the following:

Vocabulary with single cardinality.
Node with at least two terms, the one that would be processed last needs to be the one in that single cardinality vocabulary.
After update, load the node and confirm that all the terms are in the right fields.

I won't be able to work on those tests for at least the next couple of hours, but may be able to look after that.

Damien Tournoud’s picture

Status: Needs work » Needs review
FileSize
3.93 KB

The bug can be reproduced with the upgrade path tests, we are just not asserting if the terms are associated with the correct vocabulary.

Here is an extension of the current test to test the fallback logic. This should fail.

Damien Tournoud’s picture

The same patch with catch's fix. This one should pass.

Damien Tournoud’s picture

Issue tags: +beta blocker
LaurentAjdnik’s picture

FileSize
1.37 KB

Hi all,

on a purely philosophical standpoint (the '+1' looks weird and brings a tiny additional calculation), I would write:

  if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED && $deltas[$field_name] >= $field['cardinality']) {

rather than:

  if ($field['cardinality'] != FIELD_CARDINALITY_UNLIMITED && ($deltas[$field_name] + 1) > $field['cardinality']) {
Damien Tournoud’s picture

@LaurentAjdnik let's rather stick with #4:

- this has to be consistent with http://api.drupal.org/api/function/field_default_validate/7
- the condition has to make sense: what we want to check is that the number of items is strictly bigger then the cardinality. The check in #4 is just that, the check in your #6 (while accurate and more efficient) doesn't carry out this.

catch’s picture

Status: Needs review » Needs work

#3 didn't fail.

Damien Tournoud’s picture

Status: Needs work » Needs review

It properly fails for me locally. I blame the test bot.

catch’s picture

OK, going to test these locally and see.

chx’s picture

Status: Needs review » Needs work

At least the troubled line in the update needs more comments, "$delta[$field_name] +1" is the next delta and if that's more than the field cardinality........" or somesuch.

catch’s picture

Status: Needs work » Needs review
FileSize
5.52 KB

Added an extra comment there.

Status: Needs review » Needs work

The last submitted patch, 933270-taxonomy-terms-incorrectly-affected.patch, failed testing.

catch’s picture

Status: Needs work » Needs review
FileSize
5.02 KB

whitespace.

Damien Tournoud’s picture

Thou shall fail.

Damien Tournoud’s picture

Ignore #16, this one should fail in a more meaningful way.

Damien Tournoud’s picture

This one should pass.

carlos8f’s picture

+++ modules/simpletest/tests/upgrade/upgrade.taxonomy.test
@@ -98,22 +100,56 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
+        // Moreover, only vocabularies 13 to 24 are properly associated with
...
+        // More over, odd vocabularies are single, so any additional term will

Nitpick: inconsistent spelling of "moreover", also seems a little repetitive.

Powered by Dreditor.

Status: Needs review » Needs work

The last submitted patch, 933270-taxonomy-terms-incorrectly-affected.patch, failed testing.

Damien Tournoud’s picture

Status: Needs work » Needs review

Let's spin-off the XPath issue: #933856: xpath() return values are inconsistent

Damien Tournoud’s picture

Without the hunks that got spined-off.

Damien Tournoud’s picture

Same as #21 with the text edits from #18.

carlos8f’s picture

Er... #22 is identical to #21 :)

Damien Tournoud’s picture

Sorry, here it is.

ksenzee’s picture

+++ modules/simpletest/tests/upgrade/upgrade.taxonomy.test
@@ -98,22 +100,56 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
+        // In our test database, each node is arbitrary associated with all
+        // the terms, except two: one which tid is ($nid) and the other which
+        // tid is (49 - $nid).

Should be "In our test database, each node is arbitrarily associated with all terms except two: one whose tid is ($nid), and one whose tid is (49 - $nid)."

+++ modules/simpletest/tests/upgrade/upgrade.taxonomy.test
@@ -98,22 +100,56 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
+        // with the taxonomy extra field.

"to the taxonomy extra field."

+++ modules/simpletest/tests/upgrade/upgrade.taxonomy.test
@@ -98,22 +100,56 @@ class UpgradePathTaxonomyTestCase extends UpgradePathTestCase {
+        if (!$should_be_displayed) {

Ideally if ($should_be_displayed) would go first but I won't quibble.

With just the doc changes (no need to move the if clause) this is RTBC.

Powered by Dreditor.

Damien Tournoud’s picture

ksenzee’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
1.11 KB

Looks good. I verified that only comments have changed since the last testbot run (interdiff attached), so RTBC.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Wow, nice work, folks!

Committed to HEAD. Thanks!

Status: Fixed » Closed (fixed)
Issue tags: -beta blocker

Automatically closed -- issue fixed for 2 weeks with no activity.