Make WordPress Core


Ignore:
Timestamp:
08/06/2008 08:31:54 PM (16 years ago)
Author:
markjaquith
Message:

Cast to array when using foreach(). Props santosj (and thanks for your perseverance!). fixes #2784

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/rss.php

    r8503 r8572  
    535535
    536536    // if RSS parsed successfully
    537     if ( $rss and !$rss->ERROR) {
     537    if ( $rss && !$rss->ERROR) {
    538538
    539539        // find Etag, and Last-Modified
    540         foreach($resp->headers as $h) {
     540        foreach( (array) $resp->headers as $h) {
    541541            // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
    542542            if (strpos($h, ": ")) {
     
    844844        }
    845845
    846         foreach ( $rss->items as $item ) {
     846        foreach ( (array) $rss->items as $item ) {
    847847            printf(
    848848                '<li><a href="%1$s" title="%2$s">%3$s</a></li>',
     
    865865    if ( $rss ) {
    866866        $rss->items = array_slice($rss->items, 0, $num_items);
    867         foreach ($rss->items as $item ) {
     867        foreach ( (array) $rss->items as $item ) {
    868868            echo "<li>\n";
    869869            echo "<a href='$item[link]' title='$item[description]'>";
Note: See TracChangeset for help on using the changeset viewer.