Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Aug 2008 at 13:29 UTC
Updated:
13 Jul 2010 at 21:10 UTC
views_handler_argument_many_to_one::query() starts with
if (empty($this->argument)) {
(TREAT as 'where field IS NULL')
return;
}
So you can't provide an actual value of 0 (or string '0') for the argument - will be treated as NULL
Comments
Comment #1
yched commentedconsistently, the link generated by views_handler_argument_many_to_one::summary_argument() for the 'no value' item in summaries is currently [views_url]/0, so you get two different items in summaries (one for 'no value', one for '0'), with the same url.
Visible with very latest CCK (as of today), using a number field with a list of allowed values that includes 0.
Comment #2
merlinofchaos commentedThe many to one filter was built on the assumption that you're using a 'serial' type field as the key, meaning values > 1. Both 0 and -1 are actually reserved by this handler.
I'm not sure what good alternatives are, honestly. I have to pick *some* value to represent no value, and reserve it. If CCK doesn't reserve any value, then you may need to create a subclassed version that strips out these features and simply doesn't allow the 'no value' case.
Using 0 as an identifier is always somewhat dangerous in Drupal.
Comment #3
merlinofchaos commentedOk, I think the proper solution is this:
Create a field in the definition that says what the uncategorized value is. Taxonomy can use 0. If this is not present, then uncategorized should become illegal and the query should specifically disallow NULLs.
Anyone care to work on this?
Comment #4
raspberryman commentedI ran across this when a custom default argument plugin was feeding a CCK number field argument. While this isn't a long term solution, I'd thought I'd post my quick fix - a little argument handler extension...
Comment #5
dawehnerThis is now fixed. Taxonomy counts 0 as empty now.