Wordfence Security

Error with Wordfence Security

You may have this kind of error with Wordfence Security :

An error of type E_ERROR was caused in line 129 of the file /wp-content/plugins/wordfence/modules/login-security/classes/controller/settings.php. Error message: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in /wp-content/plugins/wordfence/modules/login-security/classes/controller/settings.php:129
Stack trace:
#0 /wp-content/plugins/wordfence/modules/login-security/classes/controller/settings.php(129): json_decode()
#1 /wp-content/plugins/wordfence/modules/login-security/classes/controller/notices.php(154): WordfenceLS\Controller_Settings->get_array()
#2 /wp-content/plugins/wordfence/modules/login-security/classes/controller/notices.php(117): WordfenceLS\Controller_Notices->_notices()
#3 /wp-content/plugins/wordfence/modules/login-security/classes/controller/wordfencels.php(789): WordfenceLS\Controller_Notices->enqueue_notices()
#4 /wp-includes/class-wp-hook.php(307): WordfenceLS\Controller_WordfenceLS->_admin_menu()
#5 /wp-includes/class-wp-hook.php(331): WP_Hook->apply_filters()
#6 /wp-includes/plugin.php(474): WP_Hook->do_action()
#7 /wp-admin/includes/menu.php(155): do_action()
#8 /wp-admin/menu.php(394): require_once(‘…’)
#9 /wp-admin/admin.php(158): require(‘…’)
#10 /wp-admin/plugins.php(10): require_once(‘…’)
#11 {main}
thrown`

Or :

Notice (Suppressed) Only variables should be passed by reference 1 +
wp-content/plugins/wordfence/lib/wfDiagnostic.php:348

Or :

An error of type E_COMPILE_ERROR was caused in line 3 of the file /wp-content/plugins/wordfence/lib/wordfenceClass.php. Error message: require_once(): Failed opening required ‘/wp-content/plugins/wordfence/lib/wfScanEngine.php’ (include_path=’.:/opt/alt/php74/usr/share/pear’)`

Or :

An error of type E_COMPILE_ERROR was caused in line 34 of the file /wp-content/plugins/wordfence/vendor/geoip2/geoip2/src/Database/Reader.php. Error message: Declaration of GeoIp2DatabaseReader::country($ipAddress) must be compatible with GeoIp2ProviderInterface::country(string $ipAddress): GeoIp2ModelCountry

Or :

Unable to update plugin ‘Wordfence7.4.141`’, details: PHP Warning: chmod(): Operation not permitted in /wp-admin/includes/class-wp-filesystem-direct.php on line 173

Or :

An error of type E_ERROR was caused in line 22 of the file /wp-content/plugins/wordfence/modules/login-security/classes/controller/whitelist.php. Error message: Uncaught Error: Class ‘WordfenceLS\Model_IP’ not found in /wp-content/plugins/wordfence/modules/login-security/classes/controller/whitelist.php:22
Stack trace:
#0 /wp-content/plugins/wordfence/modules/login-security/classes/controller/wordfencels.php(356): WordfenceLS\Controller_Whitelist->is_whitelisted(‘108.162.241.31’)
#1 /wp-includes/class-wp-hook.php(287): WordfenceLS\Controller_WordfenceLS->_authenticate(Object(WP_Error), ”, ‘remi-theriault’)
#2 /wp-includes/plugin.php(206): WP_Hook->apply_filters(Object(WP_Error), Array)
#3 /wp-includes/pluggable.php(549): apply_filters(‘authenticate’, NULL, ”, ‘remi-theriault’)
#4 /wp-includes/user.php

Or :

PHP Fatal error:  Unknown:
Failed opening required
'/wordfence-waf.php'
(include_path='.:') in Unknown on line 0

Or :

Update Failed: WordPress database error: [Unknown column 'is_deleted' in 'where clause']SELECT * FROM devfd_wc_admin_notes WHERE 1=1 AND type IN ('survey') AND status IN ('actioned') AND is_deleted = 0 ORDER BY date_created DESC LIMIT 0, 10WordPress database error: [Unknown column 'is_deleted' in 'where clause']SELECT * FROM devfd_wc_admin_notes WHERE 1=1 AND name IN ('wc-admin-coupon-page-moved') AND is_deleted = 1 ORDER BY date_created DESC LIMIT 0, 10WordPress database error: [Unknown column 'is_deleted' in 'where clause']SELECT * FROM devfd_wc_admin_notes WHERE 1=1 AND status IN ('unactioned') AND name IN ('wc-admin-coupon-page-moved') AND is_deleted = 0 ORDER BY date_created DESC LIMIT 0, 10{“success”:true,”data”:{“update”:”plugin”,”slug”:”wordfence”,”oldVersion”:”Version 7.4.6″,”newVersion”:”Version 7.4.14″,”plugin”:”wordfence\/wordfence.php”,”pluginName”:”Wordfence Security”,”debug”:[“Enabling Maintenance mode…”,”Downloading update from https:\/\/downloads.wordpress.org\/plugin\/wordfence.7.4.14.zip…”,”The authenticity of wordfence.7.4.14.zip could not be verified as no signature was found.”,”Unpacking the update…”,”Installing the latest version…”,”Removing the old version of the plugin…”,”Plugin updated successfully.”,”Disabling Maintenance mode…”]}}

Or :

An error of type E_ERROR was caused in line 0 of the file /wp-content/plugins/wordfence/modules/login-security/views/page/page.php. Error message: Method WordfenceLS\Model_View::__toString() must not throw an exception, caught Error: Call to undefined function esch_html__()

Or :

PHP Fatal error:  Uncaught wfWAFStorageFileException: Unable to verify temporary file contents for atomic writing. in /wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/storage/file.php:52
Stack trace:
#0 /wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/storage/file.php(1349): wfWAFStorageFile::atomicFilePutContents('/home/customer/...', 'truncate()
#2 /wp-content/plugins/wordfence/lib/wordfenceClass.php(8841): wfWAFStorageFile->truncateAttackData()
#3 /wp-includes/class-wp-hook.php(290): wordfence::syncAttackData()
#4 /wp-includes/class-wp-hook.php(316): WP_Hook-> in /wp-content/plugins/wordfence/vendor/wordfence/wf-waf/src/lib/storage/file.php on line 52

Or :

An error of type E_ERROR was caused in line 695 of the file /wp-content/plugins/wordfence/lib/wfConfig.php. Error message: Allowed memory size of 268435456 bytes exhausted (tried to allocate 25736438 bytes)

Or :

Got error ‘PHP message: WordPress database error Commands out of sync; you can’t run this command now for query SELECT *, CASE \nWHEN type = 3 THEN 0\nWHEN type = 4 THEN 1\nWHEN type = 7 THEN 2\nWHEN type = 6 THEN 3\nWHEN type = 5 THEN 4\nWHEN type = 9 THEN 5\nWHEN type = 8 THEN 6\nWHEN type = 2 THEN 7\nWHEN type = 1 THEN 8\nELSE 9999\nEND AS typeSort, CASE \nWHEN type = 3 THEN parameters\nWHEN type = 4 THEN parameters\nWHEN type = 1 THEN IP\nWHEN type = 9 THEN IP\nWHEN type = 5 THEN IP\nWHEN type = 6 THEN IP\nWHEN type = 7 THEN IP\nWHEN type = 2 THEN IP\nWHEN type = 8 THEN IP\nELSE 9999\nEND AS detailSort\n FROM wp_wfBlocks7 WHERE type IN (4) AND (expiration = 0 OR expiration > UNIX_TIMESTAMP()) ORDER BY typeSort ASC, id DESC made by wfWAFIPBlocksController::synchronizeConfigSettings, wfBlock::patternBlocks, wfBlock::allBlocksPHP message: WordPress database error Commands out of sync; you can’t run this command now for query SELECT *, CASE \nWHEN type = 3 THEN 0\nWHEN type = 4 THEN 1\nWHEN type = 7 THEN 2\nWHEN type = 6 THEN 3\nWHEN type = 5 THEN 4\nWHEN type = 9 THEN 5\nWHEN type = 8 THEN 6\nWHEN type = 2 THEN 7\nWHEN type = 1 THEN 8\nELSE 9999\nEND AS typeSort, CASE \nWHEN type = 3 THEN parameters\nWHEN type = 4 THEN parameters\nWHEN type = 1 THEN IP\nWHEN type = 9 THEN IP\nWHEN type = 5 THEN IP\nWHEN type = 6 THEN IP\nWHEN type = 7 THEN IP\nWHEN type = 2 THEN IP\nWHEN type = 8 THEN IP\nELSE 9999\nEND AS detailSort\n FROM wp_wfBlocks7 WHERE type IN (3) AND (expiration = 0 OR expiration > UNIX_TIMESTAMP()) ORDER BY typeSort ASC, id DESC made by wfWAFIPBlocksController::synchronizeConfigSettings, wfBlock::countryBlocks, wfBlock::allBlocksPHP message: WordPress database error Commands out of sync; you can’t run this command now for query SELECT *, CASE \nWHEN type = 3 THEN 0\nWHEN type = 4 THEN 1\nWHEN type = 7 THEN 2\nWHEN type = 6 THEN 3\nWHEN type = 5 THEN 4\nWHEN type = 9 THEN 5\nWHEN type = 8 THEN 6\nWHEN type = 2 THEN 7\nWHEN type = 1 THEN 8\nELSE 9999\nEND AS typeSort, CASE \nWHEN type = 3 THEN parameters\nWHEN type = 4 THEN parameters\nWHEN type = 1 THEN IP\nWHEN type = 9 THEN IP\nWHEN type = 5 THEN IP\nWHEN type = 6 THEN IP\nWHEN type = 7 THEN IP\nWHEN type = 2 THEN IP\nWHEN type = 8 THEN IP\nELSE 9999\nEND AS detailSort\n FROM wp_wfBlocks7 WHERE type IN (1, 8, 9, 2, 5, 6) AND (expiration = 0 OR expiration > UNIX_TIMESTAMP()) ORDER BY typeSort ASC, id DESC made by wfWAFIPBlocksController::synchronizeConfigSettings, wfBlock::ipBlocks, wfBlock::allBlocksPHP message: WordPress database error Commands out of sync; you can’t run this command now for query SELECT *, CASE \nWHEN type = 3 THEN 0\nWHEN type = 4 THEN 1\nWHEN type = 7 THEN 2\nWHEN type = 6 THEN 3\nWHEN type = 5 THEN 4\nWHEN type = 9 THEN 5\nWHEN type = 8 THEN 6\nWHEN type = 2 THEN 7\nWHEN type = 1 THEN 8\nELSE 9999\nEND AS typeSort, CASE \nWHEN type = 3 THEN parameters\nWHEN type = 4 THEN parameters\nWHEN type = 1 THEN IP\nWHEN type = 9 THEN IP\nWHEN type = 5 THEN IP\nWHEN type = 6 THEN IP\nWHEN type = 7 THEN IP\nWHEN type = 2 THEN IP\nWHEN type = 8 THEN IP\nELSE 9999\nEND AS detailSort\n FROM wp_wfBlocks7 WHERE type IN (7) AND (expiration = 0 OR expiration > UNIX_TIMESTAMP()) ORDER BY typeSort ASC, id DESC made by wfWAFIPBlocksController::synchronizeConfigSettings, wfBlock::lockouts, wfBlock::allBlocks’

Or :

Fatal error: Allowed memory size of 419430400 bytes exhausted (tried to allocate 312484864 bytes) in /wp-includes/Requests/Transport/cURL.php on line 484

Or :

Error writing value for wf_summaryItems (MySQLi error: [2000] Unknown MySQL error)

Or :

wp_remote_post() test back to this server failed! Response was: cURL error 35: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

There are multiple solutions to try to make it work.

Updates

The first thing to do if you are stuck with Wordfence Security is to ensure that all your WordPress is up to date. You should check your :

  • WordPress
  • Plugins
  • Theme

Once all these updates are done, check back if these errors appear.

Check Wordfence Security

Sometimes, you just need to disable the plugin, and enable it just after to make it work again.

If it doesn’t work, your Wordfence Security plugin may be corrupted. To ensure that it’s not your case, you have to re-download the plugin (or the theme delivered with the plugin) and try to install it again.

Check others plugins

Are you sure that the error is related to Wordfence Security? Maybe not.

It could be related to another plugin that is not compatible. It could happen when you use a cache plugin, a security plugin, or simply a poorly developed plugin.

Disable all plugins. Then, check for your error, if the error is still there, the problem is not related to plugins compatibility. If there are no more errors, then enable every plugin one by one and check for the error. The goal is to target the plugin involved.

Try another theme

The error can be a problem with your theme.

If it’s not already done, then you should install & activate the default WordPress theme like Twenty Twenty-Two. Check for the error, and see what is happening to be sure that your WordPress theme is not the cause.

Permalinks & htaccess

If it doesn’t work, you may have a problem with your WordPress permalinks and/or your htaccess file. You should go on your WordPress dashboard, and re-saving permalinks from the permalinks page.

Contact the developer

If all these solutions don’t work, we advise you to contact the plugin developer.

You may have found a new bug, or a specific issue. You should get in touch with the developer either on the WordPress plugin forum, either by mail, either on their specific website with their own support.

Alternative solutions

If the developer doesn’t reply, or your problem is very urgent, then you should try an alternative to the plugin.

There are thousands of plugins on the official directory, and many others outside. You should try to find and test them!

If the issue is very specific, and the plugin could not be replaced, we advise you to contact an expert.
This is the best way to ensure you're not going to break your site anymore.