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

merlinofchaos’s picture

Hm. Yes, this has come up before. It's time to fix add_where indeed.

merlinofchaos’s picture

Status: Active » Fixed

Fixed this for add_where and add_having.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.