When doing a contains filter on a view, it may not return expected results if it contains a printf identified such as %s. I discovered this when filtering for spanish was not working yet english was fine, while both where in the database. I tracked it down to the fact that in views_build_view, it grabs the query using _views_get_query, which already has substituted the arguments into the query. Then views_build_view goes on to substitute them again when it goes to run the query, breaking my query for spanish as the "like '%spanish%' ends up with the %s substituted again. It looks to me like the code should instead call _views_build_query, which does not yet have the arguments substituted into the query. I've attached a patch to views.module which does this; it solves my problems and does not seem to break anything else.

CommentFileSizeAuthor
views-broken-args.patch122 byteskoshea

Comments

merlinofchaos’s picture

Status: Needs review » Fixed

This is already fixed in -dev. Also, your patch isn't against cvs, isn't a unified diff, and doesn't include -p. And it's not the right fix, either. Please only roll patches against the -dev version, where you would have found that this bug doesn't exist.

koshea’s picture

Sorry for that, I don't think there is currently a dev snapshot of the drupal 5 branch available so I guess I missed it, just trying to help.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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