• We run WP_DEBUG in logging mode. PHP 7.0.

    The following PHP errors (NOTICE level, but still an error) show up regularly in the logs:

    
    PHP Notice:  Undefined index: comment_post_ID in {DOCUMENT_ROOT}/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1270
    PHP Notice:  Undefined index: delete_all in {DOCUMENT_ROOT}/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1300
    PHP Notice:  Undefined index: delete_all2 in {DOCUMENT_ROOT}/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 1300
    

    It’s an easy fix.

    Change line 1270 from

    
    $postid = $comment['comment_post_ID'];
    

    to

    
    $postid = ( !empty( $comment['comment_post_ID'] ) ) ? $comment['comment_post_ID'] : '';
    

    Change line 1300 from

    
    } elseif ( $_GET[ 'delete_all' ] != 'Empty Trash' && $_GET[ 'delete_all2' ] != 'Empty Spam' ) {
    

    to

    
    } elseif ( isset( $_GET['delete_all'], $_GET['delete_all2'] ) && $_GET['delete_all'] !== 'Empty Trash' && $_GET['delete_all2'] !== 'Empty Spam' ) {
    

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @rsm-support

    I’ve enabled Xdebug and wp-super-cache debug log on couple website. I figured out more details related to these warnings.

    I created issue https://github.com/Automattic/wp-super-cache/issues/385 and PR https://github.com/Automattic/wp-super-cache/pull/386. Can you look it and send me feedback?

    Thanks,
    Sasa

    Thread Starter rsm-support

    (@rsm-support)

    @stodorovic,

    Have you enabled WP_DEBUG? If not, you should enable that (in logging-only mode) as well, as you’ll still miss some things.

    We’ll check out the GitHub issue, and see if we can provide any additional insight.

    I’ve already enabled WP_DEBUG and WP_DEBUG_LOG + Xdebug for additional information (stack trace and dumping some variables). I think that’s issue when wp_delete_comment is executed from wp_delete_post (in this case, other hook will purge post cache).
    So, $GLOBALS[ 'pagenow' ] === 'edit-comments.php' should limit this code only for manual editing/removing comments (WP Dashboard).

    PS. I just figured out that isn’t good. We should use condition $GLOBALS[ 'pagenow' ] === 'edit-comments.php' && ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) to prevent executing wp_cache_post_change. I’m not sure for details. I’ll check and update github.

    • This reply was modified 8 years, 8 months ago by Saša.
    • This reply was modified 8 years, 8 months ago by Saša.
    • This reply was modified 8 years, 8 months ago by Saša.

    @rsm-support

    I updated https://github.com/Automattic/wp-super-cache/pull/386. It seems as acceptable solution now, but it seems that we need to improve function wp_cache_get_postid_from_comment in the future.

    Sasa

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

The topic ‘Additional Misc PHP Errors: Undefined index…’ is closed to new replies.