Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#12045 closed defect (bug) (fixed)

Header parsing in /wp-includes/rss.php sometimes receives Array instead of String

Reported by: wpmuguru's profile wpmuguru Owned by: dd32's profile dd32
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: HTTP API Keywords:
Focuses: Cc:


MU Trac Ticket:

It appears that some plugin is using the RSS parsing code in WPMU to load RSS data, and the HTTP library being used sometimes provides individual HTTP headers as an Array of elements rather than as as String. I haven't had much time to track down the error, and fixing the HTTP library is the proper fix, but the following quick repair does prevent the error for now:

/wp-includes/rss.php, ~line 577:

// find Etag, and Last-Modified
foreach( (array) $resp->headers as $h) {
  // 2003-03-02 - Nicola Asuni ( - fixed bug "Undefined offset: 1"
  if (is_array($h)) { $h = implode("; ", $h); }
  if (strpos($h, ": ")) {
    list($field, $val) = explode(": ", $h, 2);

Change History (4)

#1 @wpmuguru
14 years ago

  • Component changed from Multisite to Feeds

#2 @nacin
14 years ago

  • Component changed from Feeds to HTTP
  • Milestone changed from Unassigned to 3.0
  • Owner set to dd32

#3 @dd32
14 years ago

An array of headers will be returned in the event that a header is duplicated in the response.

There was a bug in 2.9 with Fopen and redirects (or proxies) which would result in multiple headers being returned which could cause this.

There's a bug i just noticed in the array returning however if there are >2 items of any of the headers in there..

The code in question here, in the RSS code, probably needs to be updated to only return a String. Some docs may need to be updated to reflect the array returning of the function as well..

#4 @dd32
14 years ago

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

(In [13848]) Fix WP_HTTP -> Snoopy Compat layer for Magpie RSS. Fixes #12045

Note: See TracTickets for help on using tickets.