can't override sort_items in multifeed + merge_items can't be overridden #14

rmccue opened this Issue Sep 29, 2009 · 0 comments


None yet

1 participant

rmccue commented Sep 29, 2009

Originally reported by Michael Shipley as issue 50

The SP function "merge_items" located at line 3010 in SP111 sorts items by calling the function "sort_items" statically, preventing "sort_items" from being overridden for a custom sort by extending the SP class.

To fix this, you need to replace "SimplePie" with "&$this" on line 3039 in SP111:

3039 usort($items, array('SimplePie', 'sort_items'));

should be:
3039 usort($items, array(&$this, 'sort_items'));

Also in the "get_items" function on line 2909 in SP111 the function "merge_items" is also called statically so its not possible to override that either by extending the SP class. It must be modified in the same way to allow it to be overridden.

2913 return SimplePie::merge_items($this->multifeed_objects, $start, $end, $this->item_limit);

should be:
2913 return $this->merge_items($this->multifeed_objects, $start, $end, $this->item_limit);

@rmccue rmccue added a commit that closed this issue Jun 30, 2012
@rmccue rmccue When sorting multifeeds, use the original class
Instead of hardcoding the sort_items method from SimplePie_Core, use the
class of the first SP item. Given that these are all cloned from the
original, it shouldn't matter which one this is taken from.

Should fix #14
@rmccue rmccue closed this in 44a0353 Jun 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment