[3.0] Let the news feed run without a current board - #9411
Merged
Sesquipedalian merged 2 commits intoAug 14, 2026
Merged
Conversation
?action=.xml;sa=news is an error page unless it is scoped to a board: Typed static property SMF\Board::$info must not be accessed before initialization Sources/Actions/Feed.php:748 getXmlNews() puts Board::$info->id into the query parameters unconditionally. The WHERE clause only uses it when there is a board, and the conditions that decide that go through empty(), which tolerates an uninitialised typed property. The parameter array does not: it reads it outright, and a feed for the whole forum has no current board to read. getXmlRecent(), a few hundred lines further down, already works around this the right way, so this does the same thing: $current_board = isset(Board::$info) ? Board::$info->id : 0; Signed-off-by: Mathias Papenbrock <mathiaspapealbert@hotmail.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sesquipedalian
requested changes
Aug 14, 2026
Co-authored-by: Jon Stovell <jonstovell@gmail.com>
Sesquipedalian
approved these changes
Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
?action=.xml;sa=newsis an error page on every forum unless it is scoped to a board:getXmlNews()putsBoard::$info->idstraight into the query parameters:The WHERE clause only uses that parameter when there is a board, and the conditions deciding it go through
empty(), which tolerates an uninitialised typed property:The parameter array does not — it reads the property outright, and a feed for the whole forum has no current board to read. So the site-wide news feed dies while the per-board one works.
getXmlRecent(), a few hundred lines further down in the same file, already does it the right way, and this now matches:Checked
As a guest on the running forum, before:
after:
This one is worth a second look precisely because
phplintandphp-cs-fixerboth pass on it and nothing in the codebase reads the feed — it only fails when something asks for the URL. Found by sweeping a stock forum's pages as a guest; every earlier sweep in this series ran as an admin and never requested it.Issues References (Fixes|Related|Closes)
Related to #7933