I've found a problem with comparing values from the form and the condition. The number of the elements in those arrays do not necessarily match, but if the needed values are a subset of the present values, the condition should be evaluated as TRUE, as in this way, it makes sense.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mr.york’s picture

FileSize
692 bytes

Here is the patch what fixes the problem.

mr.york’s picture

Status: Active » Needs review
peterpoe’s picture

Looks good, but is there a reason for filtering out $dependency_values?

mr.york’s picture

If the $dependency_values contains value from a multiple select, it might contain key => 0, that would result in bogus check.

greggles’s picture

Status: Needs review » Needs work

Based on #4.

aendra’s picture

@greggles -- I'm wanting to contribute to this issue, but am not sure "Needs work" is the proper tag. In #4, it seems like mr.york is explaining to peterpoe why he's filtering those values out -- not that the patched code results in what he says the filtering avoids.

Also, this seems like an annoying bug but not a release blocker; please correct me if I'm wrong.

greggles’s picture

Status: Needs work » Needs review

You're right, I did read that wrong. Thanks!

jbylsma’s picture

In an effort to close some release blockers, I've taken a stab at fixing this. I'm not sure if this previous patch applied to an earlier dev version, but it did not appear to properly evaluate on the current dev. I simplified the $dependency_values and $values arrays and used array_intersect to compare them, which appears to be returning the correct results.

That said, I couldn't figure out a good test case for this. Can someone post a step-by-step on reproducing the bug so I can make sure the patch is working correctly?

kaizerking’s picture

After applying this patch I am getting this errors
My field is a entity reference field where user can create new entity (entity connect module) the entity connect gets create page and after creating takes the tilte as field value and populates entity reference field

Notice: Undefined index: value in conditional_fields_evaluate_dependency() (line 1095 of C:\wamp\www\xxxxxx\sites\all\modules\conditional_fields\conditional_fields.module).
Notice: Undefined index: value in conditional_fields_evaluate_dependency() (line 1095 of C:\wamp\www\xxxxxx\sites\all\modules\conditional_fields\conditional_fields.module).
DatabaseTransactionNoActiveException: in DatabaseConnection->rollback() (line 1035 of C:\wamp\www\xxxxxx\includes\database\database.inc).

jbylsma’s picture

Can you post a test case so I can verify and diagnose this?

SocialNicheGuru’s picture

I am getting a similar issue as 9:
Notice: Undefined index: value in conditional_fields_evaluate_dependency() (line 1090 of conditional_fields/conditional_fields.module).