Database Errors in Apache Error Log
-
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).
- The topic ‘Database Errors in Apache Error Log’ is closed to new replies.