WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#9225 closed defect (bug) (fixed)

PHP error in Magpie RSS feed export

Reported by: jsixpack Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7
Component: Feeds Keywords: has-patch tested commit
Focuses: Cc:

Description

Using Wordpress 2.7.1

In the apache error log are many occurrences of these two lines:

Bad arguments. in /var/www/.../wp-includes/rss.php on line 175,
The first argument, 'map_attrs', should be either NULL or a valid callback

The problem appears to be a simple coding error: the callback function should be called as array reference, array(object, user_func).

This patch solves the problem (against trunk, rev. 10641):

Index: rss.php
===================================================================
--- rss.php	(revision 10641)
+++ rss.php	(working copy)
@@ -170,7 +170,7 @@
 		{
 			// if tags are inlined, then flatten
 			$attrs_str = join(' ',
-					array_map('map_attrs',
+					array_map(array($this, 'map_attrs'),
 					array_keys($attrs),
 					array_values($attrs) ) );

Attachments (1)

9225.diff (405 bytes) - added by Denis-de-Bernardy 5 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 FFEMTcJ5 years ago

  • Milestone changed from Unassigned to 2.7.2
  • Priority changed from high to normal

comment:2 Viper007Bond5 years ago

  • Keywords has-patch needs-testing added; rss rss.php feed error removed

comment:3 vladimir_kolesnikov5 years ago

  • Cc vladimir@… added

Erm...

Should be array_map(&$this, 'map_attrs') - note ampersand in front of this.

Denis-de-Bernardy5 years ago

comment:4 Denis-de-Bernardy5 years ago

  • Keywords tested added; needs-testing removed
  • Milestone changed from 2.7.2 to 2.8

comment:5 DD325 years ago

  • Keywords commit added

Note that as of 2.8, WordPress includes SimplePie, MagPie is no longer supported specifically.

This sounds like something that should be submitted upstream, however, I'm not too sure on if that support still even exists (I don't think so)

Might as well get this commited for those who end up using it, with the note that Magpie is dead.

comment:6 Denis-de-Bernardy5 years ago

nod. I figured many plugins are still using it, and will continue to use it, for a very long time.

comment:7 ryan5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [11016]) Fix PHP error in magpie. Props jsixpack. fixes #9225

Note: See TracTickets for help on using tickets.