• I get the following PHP notice when accessing a non existing page, e.g.
    https://…/notexists

    PHP Notice: Trying to get property ‘ID’ of non-object in …/wp-content/plugins/super-socializer/inc/social_sharing.php on line 52

    Disabled all other plugins, sweeped database, removed functions.php, saved all socializer setting screens.

    Modified social_sharing.php with the following

    
    if ( ! function_exists('write_log')) {
       function write_log ( $log )  {
          if ( is_array( $log ) || is_object( $log ) ) {
             error_log( print_r( $log, true ) );
          } else {
             error_log( $log );
          }
       }
    }
    
    function the_champ_prepare_sharing_html( $postUrl, $sharingType = 'horizontal', $displayCount, $totalShares, $shareCountTransientId, $standardWidget = false ) {
    
            global $post, $theChampSharingOptions;
    
            write_log( $post );
    
            if ( NULL === $post ) {
                write_log( $shareCountTransientId );
                $post = get_post( $shareCountTransientId );
            }
            write_log( $post );
    

    <NULL>
    0
    <NULL>
    PHP Notice: Trying to get property ‘ID’ of non-object in …/wp-content/plugins/super-socializer/inc/social_sharing.php on line 68

    What could be the issue?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Heateor Support

    (@heateor)

    Hi there,

    I am unable to reproduce this scenario at my test environment. If you drop an email at support[at]heateor[dot]com, would be able to look into it.

    Thread Starter rolfhuiber

    (@rolfhuiber)

    I could easily reproduce it with a fresh WordPress installation:

    Create WP database
    Download and install wordpress (5.1.1)

    Change wp-config.php

    
    define('WP_DEBUG', true);
    define('WP_DEBUG_LOG', true);
    define('WP_DEBUG_DISPLAY', true);
    

    Install Super Socializer plugin

    Goto Appearance -> Widgets
    Add “Super Socializer – Sharing (Standard Widget)” into the themes “Footer”.

    In Browser: https://&#8230;./notfound
    The Sharing Icons should appear on the page with the error displayed.

    In debug.log:

    
    [19-Apr-2019 11:41:11 UTC] PHP Notice:  Undefined index: show_counts in .../wp-content/plugins/super-socializer/inc/widget.php on line 217
    [19-Apr-2019 11:41:11 UTC] PHP Notice:  Undefined index: total_shares in .../wp-content/plugins/super-socializer/inc/widget.php on line 218
    [19-Apr-2019 11:41:11 UTC] PHP Notice:  Undefined index: hide_for_logged_in in .../wp-content/plugins/super-socializer/inc/widget.php on line 223
    [19-Apr-2019 11:41:33 UTC] PHP Notice:  Trying to get property 'ID' of non-object in .../wp-content/plugins/super-socializer/inc/social_sharing.php on line 52
    
    Thread Starter rolfhuiber

    (@rolfhuiber)

    We mailed several times to fix the problem. Your reply on the 22.05.2019:

    Then you need to keep the file I sent you before sending the last one in which case the icons were not appearing. That’s the solution. I will include this fix in upcoming release, so don’t worry about losing this change on updating the plugin next time.

    Since this date 2 updates were posted of the plugin, both didn’t contain a fix.

    When will you update the plugin to contain the fix?

    Plugin Author Heateor Support

    (@heateor)

    The fix will remove icons from the Archive pages and search results pages. It’s better that icons are at least appearing at these pages. You should not turn ON debugging at production site.

    Thread Starter rolfhuiber

    (@rolfhuiber)

    Generally I think the code base of WordPress and many of the plugins have a lot of failure. Running my side without debugging and not be able to reproduce issues is a NO-GO for me.
    For example the WooCommerce Currency updater will never tell you when it can not update, only in debugging mode.

    Also, defensive programming is the way to go. Know your guards (for this plugin: no post available).

    I don’t think a lot of people on our website will share our 404 page!

    In the last 4 weeks I had a 13.5 GB debug.log. I am a selfhoster, hope people of managed platforms are more lucky.

    Will look for another plugin, please don’t bother further.

    Plugin Author Heateor Support

    (@heateor)

    Okay. If you can wait, will fix it in the next release within next 24 hours.

    Plugin Author Heateor Support

    (@heateor)

    This has been fixed in version 7.12.27. You can update the plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Trying to get property ‘ID’ of non-object in …/social_sharing.php on line 52’ is closed to new replies.