Line 86 checks to make sure we are dealing with a term reference. I think the XOR is not quite right here. XOR evaluates to true if either of its operands are true, but returns false if both of its operands are true.

We only want the execution of this function to continue if we have a taxonomy_term_reference field. Let's say that $form['#field']['type'] is not set. The first operand evaluates to true. Since xor can not be short circuited like or can (because we need to make sure the other operand is NOT true) we go on and check if $form['#field']['type'] != 'taxonomy_term_reference' this evaluates to true (obviously) and we keep chugging along when $form['#field']['type'] isn't even set!

I am including a patch that alters the logic to make sure that we only continue if:

  1. $form['#field']['type'] is set
  2. $form['#field']['type'] is 'taxonomy_term_reference'

FYI: this is my first patch submission, so please let me know if I am doing anything incorrectly and I will fix.

Thanks,
Pat

CommentFileSizeAuthor
abt.logicXORfix.patch522 bytespmcdougl
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Simon Georges’s picture

Status: Active » Needs review

Changing status, as there is a patch.

  • adooo committed cc28aa6 on 7.x-1.x
    Issue #1834888 by pmcdougl: Minor Logic Bug using XOR
    

adooo queued abt.logicXORfix.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, abt.logicXORfix.patch, failed testing.

adooo’s picture

Issue summary: View changes
Status: Needs work » Closed (fixed)

My bad about the failed test... patch is already applied :)
Soon to be in a proper relase...
Sorry for keeping you waiting