Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
24 Oct 2008 at 18:21 UTC
Updated:
11 Nov 2008 at 18:01 UTC
Steps to reproduce (dumb but simple example)
- add a filter based on filter_one_to_many (e.g CCK text field with allowed values 'a' and 'b')
settings : is one of, a + b, reduce duplicates
- add exactly the same filter once again
The generated query looks like :
WHERE (node_data_field_texte_a.field_texte_value = 'a' OR node_data_field_texte_b.field_texte_value = 'b')
AND (node_data_field_texte_a.field_texte_value = '' OR node_data_field_texte_b.field_texte_value = '')
That's because, when merging the values in query::add_where(), the values are coming as a keyed array : array('a' => 'a', 'b' => 'b') (values from a FAPI select box). So the second time they're added, array_merge fails to add them again.
I fixed that by changing
$this->where[$group]['args'] = array_merge($this->where[$group]['args'], $args);
to
$this->where[$group]['args'] = array_merge($this->where[$group]['args'], array_values($args));
in query::add_where()
There might be other places to fix (at least query::add_having) - or maybe you'll prefer to prevent keyed arrays upstream ?
Comments
Comment #1
merlinofchaos commentedHm. Yes, this has come up before. It's time to fix add_where indeed.
Comment #2
merlinofchaos commentedFixed this for add_where and add_having.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.