concretecms / concretecms

Official repository for Concrete CMS development
https://www.concretecms.org
MIT License
771 stars 453 forks source link

RSS displayer view function duplicates the received RSS posts #12253

Open SvanteArvedson opened 1 week ago

SvanteArvedson commented 1 week ago

Affected Version of Concrete CMS

9.x

Description

The RSS displayer controller's view functions duplicates the received RSS posts (if not prevented by the itemsToDisplay property). This because the view function is saving both the original channel posts and the filtered posts into the same array named $posts instead of into separate variables.

How to reproduce

Add a RSS displayer block to a page, add a Items To Show value at least twice as large than the total number of posts in the RSS feed. The block will print the posts twice.

Possible Solution

Rename the variable the returned posts from the RSS channel is saved in from $posts to $channelPosts. This prevents the filtered posts and the channel posts being saved in the same variable.

Additional Context

This controller and function (ConcreteCMS 9.3.5): https://github.com/concretecms/concretecms/blob/0363dbf5a83da2c629fb293b2aef6d6891566437/concrete/blocks/rss_displayer/controller.php#L186-L212

hissy commented 1 week ago

Related PR: #10443