WordPress.org

Forums

Yet Another Related Posts Plugin (YARPP)
Bug in upgrading from yarp 3_5_2b2 (10 posts)

  1. _ikke_
    Member
    Posted 2 years ago #

    I get the error:

    Fatal error: Call to a member function get_option() on a non-object

    yarp_get_option and yarp_set_option is called while global $yarpp has not been set yet.

    Change these function calls to $this->get_option and $this->set_option to fix this.

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

  2. _ikke_
    Member
    Posted 2 years ago #

    Forgot to mention where this needs to be changed. class-core.php:625 in yarpp 4.0.4

  3. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @_ikke_ I've heard of reports like this and I'd like to resolve it. In YARPP 4.0.4, there is no mention of get_option in class-core line 625. (it says instead "function upgrade_3_5_2b2() {") Where did you change it?

    Also, when did you get this error? When you upgraded the plugin?

    A note to others: please *do not* change a reference to get_option to set_option. This will break things further.

  4. _ikke_
    Member
    Posted 2 years ago #

    Here is the code I have, including a patch to fix it:

    https://gist.github.com/Ikke/4983768

    I get this error indeed when upgrading the plugin.

  5. _ikke_
    Member
    Posted 2 years ago #

    To give more context to the issue:

    The problem is that yarpp_get_option is called from the constructor (and any methods called from the constructor) of the YARPP class. That means that global $yarpp hasn't been set yet.

    So calling yarpp_get_options tries to call $yarpp->get_options(), which results in a null reference exception.

  6. makinmyway
    Member
    Posted 2 years ago #

    I'm having this problem too and want to be advised of a solution. Thanks.

  7. _ikke_
    Member
    Posted 2 years ago #

    If you have read this post, you'd see I already have a solution.

    Open plugins/yet-another-related-posts-plugin/class-core.php, go to the function upgrade_3_5_2b2() (around line 625), en search for yarpp_ and replace it with $this->

  8. makinmyway
    Member
    Posted 2 years ago #

    _ikke_,

    I was unable to open wordpress to even make changes after the update.

    Eventually it started to work again after shutting down firefox and logging in again.

    Michael

  9. _ikke_
    Member
    Posted 2 years ago #

    This is something you do outside of wordpress, directly on the code.

  10. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @_ikke_ Thank you for identifying where that code was being called from! I just made this change and pushed the following beta:

    http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.4.0.5b1.zip

    @makinmyway: please try this version on your site.

    As this is an urgent bugfix, if I can confirm that it improves the situation for a number of people, without introducing new bugs, I would like to push this version 4.0.5 out soon. Thanks in advance for your feedback!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yet Another Related Posts Plugin (YARPP)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic