[3.0] Clear the topic and board statics instead of unsetting them - #9311
Open
albertlast wants to merge 1 commit into
Open
[3.0] Clear the topic and board statics instead of unsetting them#9311albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
enforceBans() called unset() on four static properties when showing a banned member as sitting on the board index. PHP does not allow that: Attempt to unset static property SMF\Topic::$topic_id The Error was thrown before the ban message could be built, so a banned visitor got the generic error page rather than being told why they were banned and when it expires. Assigns null instead, which is what SMF\ServerSideIncludes already does for the same properties. All four are nullable. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This was referenced Jul 28, 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.
Note
This change was produced by an LLM. The code, the commit message and this
description were all written by Claude (Anthropic), driven by @albertlast. It has
not yet had human code review.
Everything stated below was verified by actually running it against a fresh
PostgreSQL install of this branch, rather than only reasoned about. Even so,
please review it as untrusted work: the diagnosis may be right while the fix is
not what SMF would prefer stylistically or architecturally.
Description
User::enforceBans()callsunset()on four static properties when showing abanned member as sitting on the board index:
PHP does not allow that:
The
Erroris thrown before the ban message is built, so a banned visitor gets thegeneric "An error has occurred" page instead of being told why they are banned and
when it expires.
This assigns
nullinstead, which is whatSMF\ServerSideIncludesalready does forthe same properties. All four are nullable (
Topic::$topic_idandTopic::$infoareuntyped,
Board::$board_idis?int,Board::$infois?self).How this was verified
Inserted a real
cannot_accessban on the requesting IP, on PostgreSQL 17 / PHP 8.4:One caveat while reviewing: the ban page title is still "An error has occurred",
because ban messages go through the generic fatal error template. That is existing
behaviour and is not changed here. The reliable check that the real ban page is
rendering is whether the ban reason appears — the string "you are banned from
using this forum" is also present as a JavaScript variable on every page, so grepping
for it gives a false positive.
Relationship to other PRs
This is only reachable once bans work at all, so it should be reviewed together with
(or after) #9310 — without that fix every visitor is treated as banned and this code
path fires constantly. Merges cleanly alongside it.
Issues References (Fixes|Related|Closes)