WordPress Plugins and Themes

Warning: Creating default object from empty value in core

3 Replies ·

  1. Hi Justin!

    I used for years Trending Theme in a web, today i updated the php version to 7.1 and this warning message appear in the top of my site:

    Warning: Creating default object from empty value in /wp-content/themes/trending/library/functions/core.php on line 27


    function hybrid_get_prefix() { global $hybrid; /* If the global prefix isn't set, define it. Plugin/theme authors may also define a custom prefix. */ if ( empty( $hybrid->prefix ) ) $hybrid->prefix = sanitize_key( apply_filters( 'hybrid_prefix', get_template() ) ); return $hybrid->prefix; }

    Could you help me to remove this warning message?

  2. Justin Tadlock

    That issue was fixed in version 0.3. It sounds like you’re using an earlier version. The best course of action would be to upgrade.


    With that said, I do want to note that the Trending theme is now retired and no longer getting any updates. I’ll stilly gladly help with any issues that crop up.

  3. JAVidania

    Hi Justin!
    I know Trending is “deprecated” and no longer updated.
    Right now, I `m using Trending Theme version 0.3. (see below) and the warning message continues at the top of my site.
    Could i download a fresh trending version 0.3 to overwrite the files.
    Regards!

    Trending Versión: 0.3
    Por Justin Tadlock
    A theme for bloggers that uses multiple nav menus, several sidebars, and custom post layouts. It has a pixel-perfect design that’s great for any blogger who wants a new look for their site.
    
  4. Justin Tadlock

    Yes, it might be a good idea to download a fresh copy of the theme. Delete the old version. Then, upload the new version.


    It’s not an issue in Trending 0.3. I’m running PHP 7.1.1 and testing it.

    The warning is fixed in Hybrid Core 1.4.2, which Trending 0.3 uses. If you want to check if the theme has that version of HC in it, you can look in trending/library/hybrid.php. There’s a version number in the header of that file.

    But, more importantly, lines 56-59 of that file should have this bit of code:

    global $hybrid;
    
    /* Set up an empty class for the global $hybrid object. */
    $hybrid = new stdClass;
    

    That’s where we create the “object” that was otherwise empty in previous versions.