Skip to content

Merge upstream - #96

Merged
Alkarex merged 15 commits into
freshrssfrom
merge-upstream
Nov 13, 2026
Merged

Alkarex merged 15 commits into
freshrssfrom
merge-upstream

Conversation

@Alkarex

@Alkarex Alkarex commented Nov 13, 2026

Copy link
Copy Markdown
Member

Resolving conflicts with:

jtojnar and others added 15 commits October 27, 2026 12:38
This was introduced to support PHP 5.2, which did not have `DOMNode::getLineNo()`:
https://www.php.net/manual/en/domnode.getlineno.php

Since we no longer support such ancient version, we can drop the fallback.

Reverts c790a43
Reverts 75baa96
`SECURITY.md` points reporters to GitHub's private vulnerability reporting for this repository (https://github.com/simplepie/simplepie/security/advisories/new) instead of public issues.

Closes simplepie#707
Drop feeds that no longer resolve, return errors or now point to
unrelated sites, move the rest to their current https URLs, and add a
podcast feed and a non-UTF-8 (ISO-8859-2) feed.


I ran every sample URL through `SimplePie::init()` (no cache, 15 s timeout). 13 of 27 failed: DNS failures, 404/403/503s, TLS errors, timeouts or invalid XML. Two others loaded but are no longer what the link says: the Web 2.0 Show feed now serves an unrelated phone-plans site, and the Romanian ISO-8859-1 blog is a betting site (403 now anyway).

Changes:

- Removed: Afterdawn, Ajaxian, Andy Budd, Ask a Ninja, Digg, Newspond, OK/Cancel, Romanian Language, Ryan Parman, Technorati, Web 2.0 Show. The `image=true` parameter on the Andy Budd link isn't supported since a72ffd6, so it's gone too.
- Moved to their current https URLs: BBC News, Brent Simmons, Engadget, Flickr, Google News, OS News, Phil Ringnalda, XKCD, Yahoo! News, Zeldman.
- Replaced: iTunes with Apple Music's current top songs RSS (keeping `orderbydate=false`), the BBC Chinese URL with the new feeds.bbci.co.uk one, the CNET Japan EUC-JP feed with Asahi's RSS 1.0 headlines, CNN (newest item is from 2023, and rss.cnn.com fails the TLS handshake) with The Guardian's world news feed, and Harvard Law (newest item 2023) with Slashdot, which is also RSS 1.0 and has HTML in its descriptions.
- Added: NPR Planet Money (podcast enclosures) and Gazeta.pl at `https://www.gazeta.pl/pub/rss/wiadomosci.xml` (ISO-8859-2), since none of the remaining feeds use a legacy encoding. The old EUC-JP and GB2312 ones are UTF-8 now, and I couldn't find a live EUC-JP or GB2312 feed, so those labels are gone.

Re-checked on current master: 17 of 18 load. The Apple Music feed answered with a 502 on some runs and worked on others, and reddit returned a 429 on an earlier run, so those two depend on the day.

Fixes simplepie#706
This patch makes feeds that declare `xmlns="https://www.w3.org/2005/Atom"` parse as Atom 1.0.

Fixes: simplepie#746

It follows the "map multiple known URIs to the same namespace" option from that discussion, the same way the Media RSS namespace variants are already normalised in `Parser::split_ns()`. Feeds with the correct namespace are unaffected.

A live example is <https://ele-king.net/atom.xml>: master reports that no feed could be found, and with this change it parses, 15 items when I checked.

This also changes default behaviour in one more case: the normalisation applies to any element in the https namespace, not only the root. An RSS 2.0 feed that declares `xmlns:atom="https://www.w3.org/2005/Atom"` now exposes its `atom:link` elements, so `get_link(0, 'self')` and `get_link(0, 'hub')` return the self and hub URLs where master returns null. I checked this with a small RSS feed against master and the branch.
Co-authored-by: Jan Tojnar <jtojnar@gmail.com>
This patch raises the minimum PHP version to 7.4, as proposed in simplepie#963.

- composer.json requires `>=7.4.0`, and the 7.2 and 7.3 jobs are removed from the CI matrix
- the PHP version check in the `SimplePie` constructor now asks for 7.4
- the `File` class now sets `CURLOPT_SUPPRESS_CONNECT_HEADERS` when the constant exists, which resolves the TODO there. Where it doesn't exist (libcurl older than 7.54), the old stripping through `Parser::prepareHeaders()` still runs.
- the `?? null` fallbacks in `IRI::parse_iri()` for `PREG_UNMATCHED_AS_NULL` are removed, since PHP 7.4 always sets those groups
- README, the compatibility test page and CHANGELOG now say 7.4

phpunit gives the same 14 failures as master (2102 tests), and phpstan and php-cs-fixer are clean. There are no new tests, because the change removes code paths. I haven't tested the proxy CONNECT path against a real proxy.
This patch makes the parser skip whitespace (space, tab, CR, LF) in front of the `<?xml` declaration, including whitespace after a BOM.

A leading newline is a common slip on feeds generated by PHP templates. Without this, expat/libxml reject the document with "XML or text declaration not at start of entity" ("Reserved XML Name") and the feed is reported as invalid XML. Leading whitespace is allowed for documents without a declaration, so dropping it can't change a valid document.

We have been also doing this trimming in `File`. This now becomes redundant – while `Locator` and the content type sniffer read `File::$body` before it reaches the parser:

- The sniffer skips leading whitespace on its own (unknown() and feed_or_html() both start with a strspn() over whitespace).
- Locator reads the body through loadHTML(), which doesn't care, and through is_feed(), which goes to the sniffer.

But keeping that since `File` is close to being removed so no point in doing potentially breaking changes.
In preparation for removal of local file support from HTTP clients,
let’s add a separate `readLocalFile` helper method for fetching local files
and use that instead of `HTTP\Client` instance.

This will only be used for the initial fetch, which should be fine,
as local files do not support redirects.

The helper method was taken from `Psr18Client`.
It was enhanced with an extra comment explaining the `try`–`catch`,
and trimming taken from `File`.
We are going to remove support for local files from `File`.

Let’s obtain the contents ourselves and then populate a dummy `File`
from the manually constructed response.

It should be fine to use it for the legacy non-namespaced `LocatorTest`
since `Locator`, not `File`, is the unit under test.
This can lead to information leaks when discovery/redirects are triggered.

Partially fixes: https://www.github.com/simplepie/simplepie/issues/968

Fixes CVE-2026-111234
This can lead to giving access to local files if a path is passed to `set_feed_url` instead of URL.

It can be replaced by passing the contents of the file, obtained e.g. using `file_get_contents` to `SimplePie::set_raw_data()`.

Mostly reverts 15fc743
RFC 9110 allows a `Location` header to be a relative reference (for
example `Location: /feed.xml`). The PSR-18 client path used the
`Location` value directly, so a relative redirect was passed to the
injected PSR-17 `UriFactory` unresolved, and depending on the
implementation it fails or produces an invalid URI. Redirects that
should work, and do work via the cURL/`File` transport which resolves
them, break through `Psr18Client`. This change resolves the `Location`
against the current request URL before forwarding using
`Misc::absolutize_url()`, so an absolute `Location` passes through
unchanged while a relative one is resolved against the URL that returned
the redirect. A test covers the relative-redirect case.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
Resolving conflicts with:
* Require PHP 7.4 or newer simplepie#1006
* File,Psr18Client: Remove support for local files simplepie#994
@Alkarex
Alkarex merged commit 366b687 into freshrss Nov 13, 2026
18 checks passed
@Alkarex
Alkarex deleted the merge-upstream branch November 13, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants