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.
Taxonomy.admin.inc, row 282:
$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d'), $page_increment, 0, NULL, $vocabulary->vid);
I guess that it should be:
$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d', 't', 'tid'), $page_increment, 0, NULL, $vocabulary->vid);
Am I wrong?
Comment | File | Size | Author |
---|---|---|---|
#9 | taxonomy-310768-9.patch | 1.3 KB | cdale |
#4 | taxonomy-310768-4.patch | 1.23 KB | cdale |
#2 | taxonomy-310768.patch | 1.29 KB | bob_hirnlego |
Comments
Comment #1
Damien Tournoud CreditAttribution: Damien Tournoud commentedYou are perfectly right. Please submit a patch!
Comment #2
bob_hirnlego CreditAttribution: bob_hirnlego commentedHere it is... this is my first patch, hope that everything's fine.
Comment #3
catchLooks sane, not tested yet. Bumping to 7.x.
Comment #4
cdale CreditAttribution: cdale commentedI just experienced a warning due to this issue myself. I've changed it back to 6.x as I don't think this is relevant for 7.x anymore with the new hook_query_alter and all.
I've created a patch against 6.x that should correct this.
Comment #5
catchThis code is still in Drupal 7, but we're quite far from a point where hook_query_alter will take it over. I've left this at 6.x, but I've opened a Drupal 7 issue so it doesn't get lost there. #336849: Wrong $primary_field and $primary_table passed in db_rewrite_sql inside taxonomy_overview_terms()
Comment #6
cdale CreditAttribution: cdale commentedI've been running the above patch for quite some time now, and I think it is simple enough, so marking as RTBC.
Comment #7
Gábor HojtsyLooks good, committed to D6. I'd advocate committing this to D7 now, since it is a trivial patch. That would help us not loose this improvement in the shuffling between the new and old rewrite code.
Comment #9
cdale CreditAttribution: cdale commentedNew patch for D7.
Comment #10
Dries CreditAttribution: Dries commentedWe should have a test for this ...
Comment #11
cdale CreditAttribution: cdale commentedHow would I go about writing a test for this? I'm happy to attempt it, I just can't see how to go about it. And would it test just this specific db_rewrite? Or all of them?
Comment #12
catchMoving back to D6, where this doesn't need a test, since there's no db_rewrite_sql() in 7 now.
Comment #13
cdale CreditAttribution: cdale commentedThis can be marked as fixed then, as it's already been committed to D6 in #7.