This bug seems to only happen when testing a Contextual Flilter via the "Preview" functions of Views. When the View is actually called as a page, the Views query is assembled as expected.

If you create a contextual filter on virtually any field in Drupal Views and pass a filter value of "0" in, Views Preview follows the behavior specified in "WHEN THE FILTER VALUE IS NOT IN THE URL" (tested on numerical and text). In other words, it resolves "0" to be null. Below is a set of screen shots tested against the "Article" node. I created two nodes, one with the title "1" and the other with the title "0". Both are accepted as legitimate titles by Drupal, so I think Views should handle them. Image 1 shows the result with a contextual filter of "1", works as expected. A contextual filter of "0", however, returns all records and the query shows that Views assumes no filter has been submitted.

Image 1: No filter value submitted

Query and results for simple view with filter on Title field, but no filter provided in URL.

Image 2: Filter value "1" submitted

Query and results for simple view with filter on Title field, with 1 provided in URL.

Image 3: Filter value "0" submitted

Query and results for simple view with filter on Title field, with 0 provided in URL.

I am working on finding where this is handled so that I might submit a patch - any pointers would be appreciated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MustangGB’s picture

Status: Active » Closed (outdated)

Closing this as outdated, feel free to re-open with updated details if it's still a problem in the latest release.