Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • The PHP Warning’s root cause is that a page or post’s original author no longer exists in the database. This is based on the wp_user table’s user ID which is attached to a post and can be seen in the database. After digging through WordPress source code I came up with this solution which should be removed once Yoast patches it. This code can be dropped in anywhere in a theme or plugin but must be hooked before the Yoast plugin.

    $original_user = new stdClass();
    $original_user->ID = 1;
    $original_user->display_name = '';
    wp_cache_set(1, $original_user, 'users');
    Thread Starter zachwtx

    (@zachwtx)

    When you said this:

    We have previously thought when this error crops up, MySQL/MariaDB is stopping, reconnecting and leaving the connection in a state that somehow causes this error to appear.

    By “stopping” did you mean the MySQL/MariaDB server stopped? Or that the connection to the server stopped from within the PHP script during runtime?

    Am I supposed to close a wpdb connection in the PHP code I write or is that handled by the wpdb->query method?

    Thread Starter zachwtx

    (@zachwtx)

    I suspect you may be right but I have no idea where to start troubleshooting a MySQL server like that. On that support topic you linked to they were still experiencing this issue after addressing their MySQL server.

    Last night I moved our site-specific database-intensive cron jobs up in the schedule so they would not run during other cron tasks, but we still experienced the PHP notices that start with these two lines: `[04-Apr-2021 09:41:29 UTC] PHP Notice: Undefined property: stdClass::$option_value in /home/homeandranch/public_html/wp-cron.php on line 72
    [04-Apr-2021 09:41:29 UTC] PHP Notice: Undefined index: type in /home/homeandranch/public_html/wp-content/plugins/wordfence/models/block/wfBlock.php on line 722`

    Unfortunately I don’t see any Cron job scheduled for that time so I can’t say what function initiates this chain of events. Because they occur at the same time, I believe the first PHP notice is coming from Wordfence somehow.

    There isn’t anything wrong with wp_wfblocks7.

    Is there a proper way to do a wpdb query that involves connect/disconnect functions that might avoid problems with database connections?

    Thread Starter zachwtx

    (@zachwtx)

    Here is another set of error messages that includes my own error logging. This happens every day and my client is anxious to get this resolved without having to abandon using your very robust and otherwise exceptional plugin. It is also getting table rows from the wp_posts table now. The first error message shows the parameters passed to the function, the second shows the SQL query, and the third shows the errant database row that was returned by the SQL query. Please help.

    [05-Apr-2021 10:11:04 UTC] wfBlock->allBlocks(prefetch = 1, ofTypes = array(4), offset = 0, limit = -1, sortColumn = type, sortDirection = ascending, filter = )
    [05-Apr-2021 10:11:04 UTC] SELECT *, CASE 
    WHEN <code>type</code> = 3 THEN 0
    WHEN <code>type</code> = 4 THEN 1
    WHEN <code>type</code> = 7 THEN 2
    WHEN <code>type</code> = 6 THEN 3
    WHEN <code>type</code> = 5 THEN 4
    WHEN <code>type</code> = 9 THEN 5
    WHEN <code>type</code> = 8 THEN 6
    WHEN <code>type</code> = 2 THEN 7
    WHEN <code>type</code> = 1 THEN 8
    ELSE 9999
    END AS <code>typeSort</code>, CASE 
    WHEN <code>type</code> = 3 THEN <code>parameters</code>
    WHEN <code>type</code> = 4 THEN <code>parameters</code>
    WHEN <code>type</code> = 1 THEN <code>IP</code>
    WHEN <code>type</code> = 9 THEN <code>IP</code>
    WHEN <code>type</code> = 5 THEN <code>IP</code>
    WHEN <code>type</code> = 6 THEN <code>IP</code>
    WHEN <code>type</code> = 7 THEN <code>IP</code>
    WHEN <code>type</code> = 2 THEN <code>IP</code>
    WHEN <code>type</code> = 8 THEN <code>IP</code>
    ELSE 9999
    END AS <code>detailSort</code>
     FROM <code>wp_wfblocks7</code> WHERE <code>type</code> IN (4) AND (<code>expiration</code> = 0 OR <code>expiration</code> > UNIX_TIMESTAMP()) ORDER BY <code>typeSort</code> ASC, <code>id</code> DESC
    [05-Apr-2021 10:11:04 UTC] a:24:{s:2:"ID";i:404;s:11:"post_author";s:1:"1";s:9:"post_date";s:19:"2016-11-24 11:45:09";s:13:"post_date_gmt";s:19:"2016-11-24 11:45:09";s:12:"post_content";s:0:"";s:10:"post_title";s:40:"310 - Oak Forest - Somerville - Burleson";s:12:"post_excerpt";s:0:"";s:11:"post_status";s:7:"publish";s:14:"comment_status";s:6:"closed";s:11:"ping_status";s:6:"closed";s:13:"post_password";s:0:"";s:9:"post_name";s:34:"310-oak-forest-somerville-burleson";s:7:"to_ping";s:0:"";s:6:"pinged";s:0:"";s:13:"post_modified";s:19:"2017-03-20 20:49:18";s:17:"post_modified_gmt";s:19:"2017-03-20 20:49:18";s:21:"post_content_filtered";s:0:"";s:11:"post_parent";i:0;s:4:"guid";s:63:"https://website.com/property/310-oak-forest-somerville-burleson/";s:10:"menu_order";i:0;s:9:"post_type";s:8:"property";s:14:"post_mime_type";s:0:"";s:13:"comment_count";s:1:"0";s:6:"filter";s:3:"raw";}
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: type in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 727
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: type in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 727
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: IP in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 731
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: type in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 735
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: type in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 735
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: id in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: type in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: blockedTime in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: reason in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: lastAttempt in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: blockedHits in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Notice:  Undefined index: expiration in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 738
    [05-Apr-2021 10:11:04 UTC] PHP Fatal error:  Uncaught OutOfBoundsException: ipRange is not a valid property for this block type in /wp-content/plugins/wordfence/models/block/wfBlock.php:1164
    Stack trace:
    #0 /wp-content/plugins/wordfence/waf/wfWAFIPBlocksController.php(63): wfBlock->__get('ipRange')
    #1 [internal function]: wfWAFIPBlocksController::synchronizeConfigSettings()
    #2 {main}
      thrown in /wp-content/plugins/wordfence/models/block/wfBlock.php on line 1164

    After assessing our network and finding we have 20 sites using the plugin, I decided to try the process @ac-1 provided here: https://www.ads-software.com/support/topic/php7-2-502-error/page/3/#post-11203753

    Like they said, it *seems* to be working! I haven’t opened every event or setting page but I’m not seeing 502 errors while previewing in PHP 7.2. I should note that the 502 error isn’t happening on WPEngine’s staging environment or on my local environment.

    Thanks @ac-1!

    I am seeing a 502 error when JS Cache is turned off or on.

    Thread Starter zachwtx

    (@zachwtx)

    I forgot to flag it so I’m doing that now.

    Thread Starter zachwtx

    (@zachwtx)

    Alright, manually entering the field names worked. I think the issue may be that we add the custom fields using PHP embedded in our plugin. Thanks for your help!

    Plugin Author zachwtx

    (@zachwtx)

    Hey Tom, thanks for reaching out and notifying me of the issue. As we discussed over email, I was able to identify and resolve the case matching problem. Thanks for checking my plugin out!

Viewing 9 replies - 1 through 9 (of 9 total)