fix(redirects): survive FreshRSS cores older than 1.29.2 - #4
Conversation
FreshRSS_http_Util::getCurlResolveInfo() was added to core after 1.29.1 and is in no tagged release, so resolving a feed's permanent redirects raised a fatal "call to undefined method" on every released FreshRSS, taking the whole add-feed request down with a 500. Guard the call. Cores without it probe without DNS pinning, which is the same exposure they already carry for every feed fetch, since their httpGet() did not pin DNS either -- the alternative, refusing to probe, would silently disable redirect resolution on every release. PHPStan calls the guard redundant whichever core it analyses, from opposite directions, so phpstan.neon carries both suppressions; reportUnmatchedIgnored- Errors lets the inapplicable one pass. Verified clean against edge, 1.29.1 and 1.29.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Pinning the core checkout to edge is how a call to an edge-only core method reached users as a fatal error on every released FreshRSS: the one core that had the method was the only one ever analysed. Run a matrix over both ends of the supported range instead -- the development tip and 1.29.0, the oldest release this extension supports. fail-fast is off so a break on one core still reports the other. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The binding constraint is Minz_HookType::FeedsListBeforeActualize, which core added in 1.29.0. Also records which behaviour degrades on cores predating getCurlResolveInfo() rather than being required outright. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe change adds compatibility for FreshRSS versions without ChangesFreshRSS compatibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
RssCloud/Redirects.php (1)
151-160: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftAdd runtime coverage for both FreshRSS API shapes.
The CI checks prove syntax and PHPStan compatibility. They do not execute
method_exists(), validate thegetCurlResolveInfo()return handling, or verify theCURLOPT_RESOLVEsetup. Add runtime coverage for a core without the method and a core with it. Cover allowed arrays,null,false, and permanent redirect chains.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@RssCloud/Redirects.php` around lines 151 - 160, Add runtime tests for the redirect resolution flow around getCurlResolveInfo(), covering cores both without and with that method. Verify allowed array results configure CURLOPT_RESOLVE, null and false results stop resolution, and permanent redirect chains preserve the expected behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@RssCloud/Redirects.php`:
- Around line 151-160: Add runtime tests for the redirect resolution flow around
getCurlResolveInfo(), covering cores both without and with that method. Verify
allowed array results configure CURLOPT_RESOLVE, null and false results stop
resolution, and permanent redirect chains preserve the expected behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5866fd63-9551-44ec-bee5-6c335c306448
📒 Files selected for processing (4)
.github/workflows/ci.ymlREADME.mdRssCloud/Redirects.phpphpstan.neon
The bug
Adding a feed 500s on every released FreshRSS:
getCurlResolveInfo()was added to core on 2026-06-28 (FreshRSS/FreshRSS#8400) and is contained inno tagged release —
git tag --containson that commit is empty. The newest stable release is1.29.1, tagged 2026-05-20, five weeks earlier, and that is what the
freshrss/freshrss:latestDocker image ships. So
onFeedBeforeInsertfatals and takes the whole add-feed request with it.The fix
Guard the call. Cores without the method probe without DNS pinning, which is the same exposure they
already carry for every feed fetch — their
httpGet()did not pin DNS either. The alternative,refusing to probe, would have silently disabled redirect resolution on every release, which is the
feature's whole point.
PHPStan calls the guard redundant whichever core it analyses, just from opposite directions
(
alreadyNarrowedTypeagainst edge,impossibleTypeagainst 1.29.1). Both suppressions live inphpstan.neon;reportUnmatchedIgnoredErrors: falsewas already set, so the inapplicable onepasses unmatched and a single config serves either core. Both are scoped to the one file and one
message, and marked for deletion along with the guard once 1.29.2 is the oldest supported release.
Why it shipped
ci.ymlpinned the core checkout toref: edge— the one core that has the method was the onlyone ever analysed. It now runs a matrix over both ends of the supported range,
edgeand1.29.0,with
fail-fast: false.1.29.0is the true floor:Minz_HookType::FeedsListBeforeActualizeis the binding constraint. Iverified that rather than assuming it, since CI now depends on it.
Verification
[OK] No errorslatest)[OK] No errors[OK] No errorsextensions/re-enabled)php -lAnalysing 1.29.1 also confirmed the useful negative:
getCurlResolveInfowas the onlyincompatibility. No signature drift anywhere else —
httpGet()'s positional args,checkUrl()'sfixScheme:named arg and the hook callback shapes all still match.Static analysis only. There is no test suite here, so nothing exercises an actual redirect
probe; this proves the call cannot fatal, not that the unpinned path behaves correctly at runtime.
permanentLocation()is the natural first candidate for coverage.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests
edgeand version 1.29.0.