WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] version 3.4 throws error: warning: array_merge(): argumen (18 posts)

  1. azn137
    Member
    Posted 2 years ago #

    The title says it all, here's the text of the error message:

    Warning: array_merge() [function.array_merge]: Argument #2 is not an array in [blah blah]/class-core.php on line 141 (also, line 146)

    Any idea why?

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

  2. jlapitan
    Member
    Posted 2 years ago #

    same problem

  3. azn137
    Member
    Posted 2 years ago #

    Looks like the previous version didn't overload this function, and this one just borked it. Here's the offending function:

    function get_option( $option = null ) {
    		$options = get_option( 'yarpp' );
    		// ensure defaults if not set:
    		$options = array_merge( $this->default_options, $options );
    		// some extra work is required for arrays:
    		foreach ( $this->default_options as $key => $default ) {
    			if ( !is_array($default) )
    				continue;
    			$options[$key] = array_merge( $this->default_options[$key], $options[$key] );
    		}
    		if ( !isset($options['weight']['tax']) )
    			$options['weight']['tax'] = $this->default_options['weight']['tax'];
    
    		if ( is_null( $option ) )
    			return $options;
    
    		$optionpath = array();
    		$parsed_option = array();
    		wp_parse_str($option, $parsed_option);
    		$optionpath = $this->array_flatten($parsed_option);
    
    		$current = $options;
    		foreach ( $optionpath as $optionpart ) {
    			if ( !is_array($current) || !isset($current[$optionpart]) )
    				return null;
    			$current = $current[$optionpart];
    		}
    		return $current;
    	}
  4. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    What happens if you change line 139 to be

    $options = (array) get_option( 'yarpp', array() );

    ?

  5. rahmis
    Member
    Posted 2 years ago #

    Thanks mitcho. That did the trick for me.

  6. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    I pushed this hotfix to the 3.4 tag... hopefully wordpress.org will repackage it quickly.

  7. jlapitan
    Member
    Posted 2 years ago #

    how will we know if it has been fixed? an upgrade notification?

  8. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    The zip archive has been updated. Just download again and replace your files:

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

  9. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the quick report!

  10. jlapitan
    Member
    Posted 2 years ago #

    thanks! where are the previous settings on the plugin? like the accuracy for related posts

  11. azn137
    Member
    Posted 2 years ago #

    That zip did the trick for me. Thanks.

  12. jlapitan
    Member
    Posted 2 years ago #

    saw it already, screen options

  13. jlapitan
    Member
    Posted 2 years ago #

    why is it that there are no related posts being displayed?

    another error i noticed:

    when you check the SHOW excerpt this message appears on the textbox

    <b>Warning</b>: array_merge() [function.array-merge]: Argument #2 is not an array in <b>/home/mysite/public_html/v2/wp-content/plugins/yet-another-related-posts-plugin/class-core.php</b> on line <b>146</b>
    <small>

  14. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @jlapitan you'll want to replace your files with the new 3.4 zip.

  15. jlapitan
    Member
    Posted 2 years ago #

    i did

  16. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    If you're using the 3.4 zip from wordpress.org, there is no array_merge function on line 146:

    https://plugins.trac.wordpress.org/browser/yet-another-related-posts-plugin/tags/3.4/class-core.php#L146

  17. jlapitan
    Member
    Posted 2 years ago #

    uploading manually the plugin.. thanks for the info...

  18. jlapitan
    Member
    Posted 2 years ago #

    why there is still no related posts showing even though i set the treshold to 0..(out of topic)

  19. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    @jlapitan I'm trying to diagnose an issue where no related posts display for some people. There are instructions here on how to help me figure out this issue:

    http://wordpress.org/support/topic/no-related-posts-1?replies=23#post-2464940

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic