With exposed filters, and without setting at least one filter option you got the next error (working with gmap module together):
* warning: max() [function.max]: Array must contain at least one element in /sites/all/modules/views/includes/query.inc on line 659.
* warning: implode() [function.implode]: Invalid arguments passed in /sites/all/modules/views/includes/query.inc on line 842.
* warning: implode() [function.implode]: Invalid arguments passed in /sites/all/modules/views/includes/query.inc on line 842.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /sites/all/modules/views/includes/query.inc on line 970.
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 10' at line 9 query: SELECT DISTINCT(node.nid) AS nid, location.latitude AS gmap_lat, location.longitude AS gmap_lon, node.type AS gmap_node_type FROM node node LEFT JOIN location_instance location_instance ON node.vid = location_instance.vid LEFT JOIN location location ON location_instance.lid = location.lid WHERE LIMIT 0, 10 in /sites/all/modules/views/includes/view.inc on line 731.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | views_or-396094-empty_exposed_filters_arguments.patch | 1.87 KB | arithmetric |
Comments
Comment #1
Alice Heaton commentedCan you clarify whether :
1. You have just one exposed filter or several ;
2. If you have several exposed filters, does the error happen when just one of them is empty, or only when all of them are empty ? ;
3. Is the exposed filter part of the Views Or alternative, or is it out of the alternative ?
Thanks,
Anselm
Comment #2
Andan commented1. You have just one exposed filter or several ;
2 exposed filter, without non-exposed
2. If you have several exposed filters, does the error happen when just one of them is empty, or only when all of them are empty ? ;
I got error just when there is no rule for filtering. if one of the exposed filters got a rule, it works fine.
3. Is the exposed filter part of the Views Or alternative, or is it out of the alternative ?
Hm... with my drupal knowledge I should say it is part of the views, tipical taxonomy/node filtering.
But anyway here is the url. I've put the views export on the page.
jsd.hu/map
Thanks!
Daniel
Comment #3
Andan commentedOne solution:
I've given a not exposed filter, what don't do anything. When Views able to do one filtering, views_or do not generate the problem.
Comment #4
darren ohPlease confirm that this is a problem with the current code, otherwise this issue will be closed.
Comment #5
darren ohI have found the problem with arguments when no argument is given. We never get to finish processing the alternatives block, and an empty WHERE statement result. I will investigate.
P.S. What I have found is that when a Views Or group comes after a normal argument and no argument is given for the Views Or group, the Views Or group starts to process the arguments but cannot finish, resulting in an empty WHERE statement. I'm going to try to solve this by adding dummy arguments to those that don't provide their own defaults.
Comment #6
arithmetric commentedI also encountered this issue with the current dev version, where if exposed filters have no default or user-specified value, an empty SQL where clause is created that causes an error.
Attached is a patch that resolves this issue for me.
I applied the same logic to the argument handler, which might be relevant to the issue described in #566976: SQL Syntax warning and query failure.
Comment #7
henrijs.seso commentedPatch at #6 got rid of SQL syntax error.