Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#3527 closed defect (bug) (fixed)

wp-includes/rss-functions.php function get_rss has a bug

Reported by: zuzara's profile zuzara Owned by:
Milestone: 2.0.8 Priority: low
Severity: minor Version: 2.0.6
Component: General Keywords: get_rss
Focuses: Cc:

Description

Version 2.0.6 has a typo bug in wp-include/rss-functions.php ( Revision 4495, wp-includes/rss.php )

*** rss-functions.php   2007-01-05 22:30:06.000000000 +0900
--- rss-functions.php.new       2007-01-05 22:32:49.000000000 +0900
***************
*** 838,844 ****
  }

  function get_rss ($uri, $num = 5) { // Like get posts, but for RSS
!       $rss = fetch_rss($url);
        if ( $rss ) {
                $rss->items = array_slice($rss->items, 0, $num_items);
                foreach ($rss->items as $item ) {
--- 838,845 ----
  }

  function get_rss ($uri, $num = 5) { // Like get posts, but for RSS
!       $num_items = $num;
!       $rss = fetch_rss($uri);
        if ( $rss ) {
                $rss->items = array_slice($rss->items, 0, $num_items);
                foreach ($rss->items as $item ) {

Change History (13)

#1 follow-up: @markjaquith
18 years ago

  • Milestone 2.0.7 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Looks fine to me in /branches/2.0/ and /trunk/

#2 in reply to: ↑ 1 @yskin
18 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened
  • Summary changed from wp-include/rss-functions.php function get_rss has a bug to wp-includes/rss-functions.php function get_rss has a bug
  • Version set to 2.0.6

Replying to markjaquith:

Looks fine to me in /branches/2.0/ and /trunk/

In the end of /trunk/wp-includes/rss.php

function get_rss ($uri, '''$num = 5''') { // Like get posts, but for RSS 
     $rss = fetch_rss($url); 
     if ( $rss ) { 
         $rss->items = array_slice($rss->items, 0, '''$num_items'''); 
         foreach ($rss->items as $item ) { 
             echo "<li>\n"; 
             echo "<a href='$item[link]' title='$item[description]'>"; 
             echo htmlentities($item['title']); 
             echo "</a><br />\n"; 
             echo "</li>\n"; 
         } 
         return $posts; 
     } else { 
         return false; 
     } 
 } 

$num_items should be $num.

This is a typo bug in both 2.0.6 and 2.1

#3 follow-up: @foolswisdom
18 years ago

yskin, providing the symptom / how the problem shows itself is also often useful.

#4 @foolswisdom
18 years ago

  • Milestone set to 2.1

#5 @ryan
18 years ago

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

(In [4718]) Fix typos in get_rss(). Props zuzara. fixes #3527

#6 @ryan
18 years ago

  • Milestone changed from 2.1 to 2.0.8
  • Resolution fixed deleted
  • Status changed from closed to reopened

#7 @ryan
18 years ago

Fixed in 2.1. Reopening for 2.0.8 consideration.

#8 in reply to: ↑ 3 ; follow-up: @yskin
18 years ago

Replying to foolswisdom:

yskin, providing the symptom / how the problem shows itself is also often useful.

I was light on this ticket, and than take a look at source code. I thought it is a manifest typo bug, so I reopened it.

I think no problems was cause by this bug, because function get_rss is not be used(called) in wordpress 2.0.6 source code.

My english is poor and my php is poor too, so I am apologise if I make any mistakes.

#9 follow-up: @Otto42
18 years ago

The function immediately above it, wp_rss(), is basically identical except that it also outputs <UL> tags around the list of links, and does not have the same bug. It should probably be modified to call get_rss() to do its actual work, instead of duplicating the code.

#10 in reply to: ↑ 8 ; follow-up: @foolswisdom
18 years ago

Replying to yskin:

My english is poor and my php is poor too, so I am apologise if I make any mistakes.

Your bug report and sticking to it when markjaquith missed the problem is fantastic!

I was just providing another tip. Thanks for participating in WordPress!

#11 in reply to: ↑ 9 @foolswisdom
18 years ago

Replying to Otto42:

The function immediately above it, wp_rss(), is basically identical except that it also outputs <UL> tags around the list of links, and does not have the same bug. It should probably be modified to call get_rss() to do its actual work, instead of duplicating the code.

If the problem is on trunk and you are able submit a patch. Probably best to create a new ticket, because I start to get confused when there are new problems added later to a ticket.

#12 in reply to: ↑ 10 @markjaquith
18 years ago

Replying to foolswisdom:

Replying to yskin:

My english is poor and my php is poor too, so I am apologise if I make any mistakes.

Your bug report and sticking to it when markjaquith missed the problem is fantastic!

Doh! I reverted to how the code was and looked again. I was looking at the wp_rss() function right above it which is VERY similar, but did not have the bug described. Nice catch, yskin.

#13 @markjaquith
18 years ago

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

(In [4835]) Fix typos in get_rss(). Props zuzara. fixes #3527

Note: See TracTickets for help on using tickets.