• Resolved jrigexor

    (@jrigexor)


    Hello. I don’t know if this changed recently, but I just started seeing database query errors in my Apache Error log. The errors look like this:

    WordPress database error Unknown column 'blacklist' in 'where clause' for query SELECT SUM(blockCount) as blockCount\nFROM wp_wfBlockedIPLog\nWHERE unixday >= FLOOR(UNIX_TIMESTAMP(DATE_SUB(NOW(), interval 7 day)) / 86400) AND blockType IN ("blacklist", "manual") made by do_action('toplevel_page_Wordfence'), WP_Hook->do_action, WP_Hook->apply_filters, wordfence::menu_dashboard, require('/plugins/wordfence/lib/menu_dashboard.php')

    The issue appears to be caused by the queries made by the file:

    wordfence/lib/wfActivityReport.php

    at line 231. The issue is that the $groupingWHERE clause is surrounding the strings in the queries with double quotes, instead of single quotes. This isn’t an issue if the database backend is maria-db (AFAICT), but if the backend is a newer version of MySQL (in my case MySQL v8+), I will see these errors whenever this query is run. From my preliminary research, it seems that single quotes instead of double quotes surrounding strings is generally more portable across RDBMSs, so this may affect other queries, but this is the only instance that I’ve personally seen pop up.

    If I replace the double quotes with single quotes I no longer see the error produced when running the query.

    If you need anything more specific about this issue let me know and I will respond as soon as I can.

    Thank you for you time.

    P.S. I forgot to mention that I am seeing this error in the most recent version of Wordfence (v7.4.7 as of this writing).

    • This topic was modified 4 years, 10 months ago by jrigexor.
    • This topic was modified 4 years, 10 months ago by jrigexor.
Viewing 1 replies (of 1 total)
  • Thread Starter jrigexor

    (@jrigexor)

    After some further digging, it appears that there were some changes made to managed database servers (when this was I don’t know – I only recently noticed these errors) on Digital Ocean. The sql mode includes ANSI_QUOTES under the database settings which causes queries with double quotes to fail. Removing the ANSI_QUOTES settings fixes this issue and also address this problem that occurs with other plugins. Sorry for the mix up – hopefully if someone else sees this it can address their issue, and if anyone on your support forum shows up with a similar issue this can help them resolve it as well.

Viewing 1 replies (of 1 total)
  • The topic ‘Database Errors in Apache Error Log’ is closed to new replies.