Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | conditional_fields-dep_values_eval_fix-1547646-8.patch | 2.2 KB | jbylsma |
| |||
#1 | issue-1559048-1.patch | 692 bytes | mr.york |
Comments
Comment #1
mr.york CreditAttribution: mr.york commentedHere is the patch what fixes the problem.
Comment #2
mr.york CreditAttribution: mr.york commentedComment #3
peterpoe CreditAttribution: peterpoe commentedLooks good, but is there a reason for filtering out $dependency_values?
Comment #4
mr.york CreditAttribution: mr.york commentedIf the $dependency_values contains value from a multiple select, it might contain key => 0, that would result in bogus check.
Comment #5
gregglesBased on #4.
Comment #6
aendra CreditAttribution: aendra commented@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.
Comment #7
gregglesYou're right, I did read that wrong. Thanks!
Comment #8
jbylsma CreditAttribution: jbylsma commentedIn 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?
Comment #9
kaizerking CreditAttribution: kaizerking commentedAfter 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).
Comment #10
jbylsma CreditAttribution: jbylsma commentedCan you post a test case so I can verify and diagnose this?
Comment #11
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI am getting a similar issue as 9:
Notice: Undefined index: value in conditional_fields_evaluate_dependency() (line 1090 of conditional_fields/conditional_fields.module).