WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#3527 closed defect (bug) (fixed)

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

Reported by: 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)

comment:1 follow-up: markjaquith7 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/

comment:2 in reply to: ↑ 1 yskin7 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

comment:3 follow-up: foolswisdom7 years ago

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

comment:4 foolswisdom7 years ago

  • Milestone set to 2.1

comment:5 ryan7 years ago

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

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

comment:6 ryan7 years ago

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

comment:7 ryan7 years ago

Fixed in 2.1. Reopening for 2.0.8 consideration.

comment:8 in reply to: ↑ 3 ; follow-up: yskin7 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.

comment:9 follow-up: Otto427 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.

comment:10 in reply to: ↑ 8 ; follow-up: foolswisdom7 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!

comment:11 in reply to: ↑ 9 foolswisdom7 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.

comment:12 in reply to: ↑ 10 markjaquith7 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.

comment:13 markjaquith7 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.