WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
Trying to get property of non-object in define.php (1 post)

  1. flynsarmy
    Member
    Posted 1 year ago #

    I'm getting the following error in my logs - I'd assume when editing comments?

    PHP Notice: Trying to get property of non-object in /path/to/wp-content/plugins/w3-total-cache/inc/define.php on line 1432, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP Stack trace:, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 1. {main}() /path/to/wp-admin/admin-ajax.php:0, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 2. do_action() /path/to/wp-admin/admin-ajax.php:72, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 3. call_user_func_array() /path/to/wp-includes/plugin.php:406, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 4. wp_ajax_dim_comment() /path/to/wp-includes/plugin.php:406, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 5. wp_set_comment_status() /path/to/wp-admin/includes/ajax-actions.php:539, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 6. do_action() /path/to/wp-includes/comment.php:1471, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 7. call_user_func_array() /path/to/wp-includes/plugin.php:406, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 8. W3_Plugin_ObjectCache->on_change() /path/to/wp-includes/plugin.php:406, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1
    PHP 9. w3_is_flushable_post() /path/to/wp-content/plugins/w3-total-cache/lib/W3/Plugin/ObjectCache.php:208, referer: http://www.mysite.com/wp-admin/edit-comments.php?p=1093&approved=1

    I've got disqus plugin installed, perhaps that's why. In any case you should probably be confirming get_post() in method w3_is_flushable_post() is returning an object.

    Change

    function w3_is_flushable_post($post, $module, $config) {
        if (is_numeric($post))
            $post = get_post($post);

    to

    function w3_is_flushable_post($post, $module, $config) {
        if (is_numeric($post))
            $post = get_post($post);
        if ( !is_object($post) )
            return false;

    http://wordpress.org/extend/plugins/w3-total-cache/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.