Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When the default setting for an argument is "Use empty text", any user who does not have administer nodes permission and loads the view without the argument will get an SQL error. This is because db_rewrite_sql()
adds join and where clauses even to empty queries.
Comment | File | Size | Author |
---|---|---|---|
#3 | views.module-205390.patch | 598 bytes | Darren Oh |
#1 | views.module-205390.patch | 590 bytes | Darren Oh |
Comments
Comment #1
Darren OhThe attached patch adds a test for empty queries.
Comment #2
digikami CreditAttribution: digikami commentedshould probably be
Comment #3
Darren OhGood catch.
Comment #4
catchBumping priority since there's a few duplicates around.
Comment #5
dropcube CreditAttribution: dropcube commentedIf a module that rewrites queries is installed and an empty query is generated by
_views_get_query
and error is caused due todb_rewrite_sql()
generates an incorrect query.The above patch fixes the issue.
Comment #6
suit4 CreditAttribution: suit4 commentedPatch views.module-205390.patch works for me, too.
Comment #7
bwong CreditAttribution: bwong commentedI found this the hard way, using the Trace module. This patch works for me.
Comment #8
sunThis was already fixed in #247420: SQL error when using empty text as argument default and #217015: Views module sends null query when building a block, and has been committed.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.