• Resolved Anonymous User 14808221

    (@anonymized-14808221)


    I am getting the same error as reported here

    The error is:
    Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in /var/www/html/wp-content/plugins/wordfence/lib/wfConfig.php:545 Stack trace: #0 /var/www/html/wp-content/plugins/wordfence/lib/wfConfig.php(545): json_decode() #1 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(700): wfConfig::getJSON() #2 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(719): wfUtils::whitelistPresets() #3 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(750): wfUtils::whitelistedServiceIPs() #4 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(776): wfUtils::getIPWhitelist() #5 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(934): wfUtils::isPrivateAddress() #6 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(1117): wfUtils::getCleanIPAndServerVar() #7 /var/www/html/wp-content/plugins/wordfence/lib/wfUtils.php(1048): wfUtils::getIPAndServerVariable() #8 /var/www/html/wp-content/plugins/wordfence/lib/wfLog.php(114): wfUtils::getIP() #9 /var/www/html/wp-content/plugins/wordfence/lib/wordfenceClass.php(1132): wfLog->initLogRequest() #10 /var/www/html/wp-content/plugins/wordfence/wordfence.php(95): wordfence::install_actions() #11 /var/www/html/wp-admin/includes/plugin.php(2300): include('...') #12 /var/www/html/wp-admin/plugins.php(191): plugin_sandbox_scrape() #13 {main} thrown in /var/www/html/wp-content/plugins/wordfence/lib/wfConfig.php on line 545

    Running an NGINX VPS with PHP 8 as suggested by the hosting service.
    I am aware that WP is itself not really yet PHP 8 compatible and many plugins are not either, but the fact is that running WP, Toolset, several custom plugins and theme produces no issues at all. I also do not believe the issue is due to PHP 8, rather, as see below, something else.

    I have of course tried to disable all Plugins and enable only WF, however run in the precise same issue.

    I tried to debug it, and found that when I dump the error throwing line (544) $json = self::get($key, $default, $allowCached); then I get an empty array as result.
    That probably is due to the underlying error I have seen:

    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfconfig' doesn't exist for query SELECT name, val, autoload FROM wp_wfconfig WHERE name = 'allowLegacy2FA' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), require_once('/plugins/wordfence/lib/wordfenceClass.php'), wfCredentialsController::useLegacy2FA, wfCredentialsController::allowLegacy2FA, wfConfig::get
    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfls_settings' doesn't exist for query SELECT <code>name</code>, <code>value</code>, <code>autoload</code> FROM <code>wp_wfls_settings</code> WHERE <code>name</code> = 'allow-xml-rpc' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), require_once('/plugins/wordfence/lib/wordfenceClass.php'), require('/plugins/wordfence/modules/login-security/wordfence-login-security.php'), WordfenceLS\Controller_WordfenceLS->init, WordfenceLS\Controller_WordfenceLS->_init_actions, WordfenceLS\Controller_Settings->get_bool, WordfenceLS\Controller_Settings->get, WordfenceLS\Settings\Model_DB->get
    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfconfig' doesn't exist for query SELECT name, val, autoload FROM wp_wfconfig WHERE name = 'apiKey' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), wordfence::install_actions, wordfence::getLog, wfLog::shared, wfConfig::get
    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfconfig' doesn't exist for query SELECT name, val, autoload FROM wp_wfconfig WHERE name = 'howGetIPs' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), wordfence::install_actions, wfLog->initLogRequest, wfUtils::getIP, wfUtils::getIPAndServerVariable, wfConfig::get
    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfconfig' doesn't exist for query SELECT name, val, autoload FROM wp_wfconfig WHERE name = 'detectProxyRecommendation' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), wordfence::install_actions, wfLog->initLogRequest, wfUtils::getIP, wfUtils::getIPAndServerVariable, wfConfig::get
    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfconfig' doesn't exist for query SELECT name, val, autoload FROM wp_wfconfig WHERE name = 'howGetIPs_trusted_proxies' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), wordfence::install_actions, wfLog->initLogRequest, wfUtils::getIP, wfUtils::getIPAndServerVariable, wfUtils::getCleanIPAndServerVar, wfConfig::get
    [12-Apr-2021 18:40:04 UTC] WordPress database error Table 'database_name.wp_wfconfig' doesn't exist for query SELECT name, val, autoload FROM wp_wfconfig WHERE name = 'whitelistPresets' made by activate_plugin, include_once('/plugins/wordfence/wordfence.php'), wordfence::install_actions, wfLog->initLogRequest, wfUtils::getIP, wfUtils::getIPAndServerVariable, wfUtils::getCleanIPAndServerVar, wfUtils::isPrivateAddress, wfUtils::getIPWhitelist, wfUtils::whitelistedServiceIPs, wfUtils::whitelistPresets, wfConfig::getJSON, wfConfig::get

    So to summarise it, perhaps this seems due to the Database tables not being created, hence the offending line results in an empty array and cannot be converted to JSON String.

    That made me think, and results that this is a site migration where we had to delete all wf_ database tables due to problems after migration with the login.
    So, perhaps WF still has something in the options table telling it is already installed and doesnt create the database tables anymore?
    Hence the Query SELECT fails, hence the array is not populated and results in failure to build the JSON String?

    Bottom line, any suggestion to resolve this?

    • This topic was modified 3 years, 11 months ago by Anonymous User 14808221. Reason: Edit title as more adequate
    • This topic was modified 3 years, 11 months ago by Anonymous User 14808221. Reason: darn typo!
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support WFAdam

    (@wfadam)

    Hello @bedas and thanks for reaching out to us!

    Can you send a diagnostic report to wftest @ wordfence . com? You can find the link to do so at the top of the Wordfence Tools > Diagnostics page. Then click on “Send Report by Email”. Please add your forum username where indicated and respond here after you have sent it.

    Thanks again!

    Thread Starter Anonymous User 14808221

    (@anonymized-14808221)

    Hello @wfadam

    First of all sorry I didn’t reply sooner, I plain simple once more didn’t receive any email from the thread here (it happened in past already with other WordPress threads)

    Anyway, I’d certainly do what you ask, however with a fatal error I’m not really able to access my site or backend anymore – therefore I’m not sure how to even get that report

    As soon I activate WF my site will be down due to the fatal, with or without debug log on.
    Can I send a copy of the site perhaps using the same approach?

    I could scramble the database for anonymity and you could then see the error + source to investigate

    Let me know if this can help you?

    • This reply was modified 3 years, 11 months ago by Anonymous User 14808221.
    Plugin Support WFAdam

    (@wfadam)

    Could you send me the Error logs from your site? We might be able to see exactly what is happening. If you can, send them to wftest @ wordfence . com with subject “bedas for WFADAM” and let me know when you have sent it!

    Could you also list your plugins/PHP version/WP version here for me to review?

    Thanks again!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal Error due to PHP 8 Compatibility OR missing Database Tables’ is closed to new replies.