laminas / laminas-feed

Consume and generate Atom and RSS feeds, and interact with Pubsubhubbub.

Home Page:https://docs.laminas.dev/laminas-feed/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feedLink() is broken, returns invalid data if not found

Crell opened this issue · comments

Bug Report

Q A
Version(s) 2.15

Summary

The getFeedLink() method is broken and returns invalid data.

Current behavior

getFeedLink() on an RSS feed falls back to the Atom\Feed extension, and calls it's getFeedLink() method.

Atom\Feed::getLink() first looks for a <link rel="self" /> element to get a link. If it finds nothing, it gets an empty string. So far so good.

However, it then calls absolutiseUrl() on that value unconditionally, which when passed an empty string dutifully slaps the base domain of the feed onto the start of an empty string, giving you the domain of the site... Which is almost certainly not the self link of the feed, and may not even be related to the feed in the first place. But that's what then gets returned.

How to reproduce

Feed (no pun intended) any RSS feed with no self link into it and call getFeedLink().

Expected behavior

According to the method signatures, it should return null if there is no self link.

@Crell
Thanks for reporting!

Unfortunately, I can not reproduce the problem. Can your provide an uni test which illustrates the problem?
Thanks in advance! 👍

Feed entry link is null for below feed source [fox news]

getPermalink() is returning null.

https://feeds.feedburner.com/foxnews/latest

It should probably return null for all of Fox News 🤣

Jokes apart, we'd need this as an automated test case, in order for it to be fixed.