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.

Comments

StatusFileSize
new692 bytes

Here is the patch what fixes the problem.

Status:Active» Needs review

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

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

Status:Needs review» Needs work

Based on #4.

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

Status:Needs work» Needs review

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

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?

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

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

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