Skip to content

Fix a minor capitalization error - #9660

Closed
Oldiesmann wants to merge 3 commits into
SimpleMachines:release-3.0from
Oldiesmann:capital_f
Closed

Oldiesmann wants to merge 3 commits into
SimpleMachines:release-3.0from
Oldiesmann:capital_f

Conversation

@Oldiesmann

Copy link
Copy Markdown
Contributor

Signed-off-by: oldiesmann oldiesmann@gmail.com

Description

This fixes a minor capitalization error in Upgrade.php. We want to run the FetchSMFiles task after upgrading but the class name gets inserted into the DB as "SMF\Tasks\FetchSMfiles", causing an error since PHP is case sensitive for class names

Signed-off-by: oldiesmann <oldiesmann@gmail.com>
Comment thread Sources/Maintenance/Tools/Upgrade.php Outdated
],
[
[
'SMF\\Tasks\\UpdateSpoofDetectorNames',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SMF\Tasks\UpdateSpoofDetectorNames:class,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if the suggestion will work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused as to why the addition of "::class" is necessary here. The code should know what to call based on the class name. This just changes the upgrade to store the class name in the correct case.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static Analysis tools (such as those on IDEs) will see its missing and know it should exist. Before, it was a string and just a valid string.

@Sesquipedalian Sesquipedalian Sep 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion has a typo. Needs to be ::, not just :.

Also needs a leading backslash so that the class is resolved against root instead of SMF\Tasks.

Co-authored-by: Jeremy D <jdarwood007@users.noreply.github.com>
Comment thread Sources/Maintenance/Tools/Upgrade.php Outdated
Sesquipedalian pushed a commit that referenced this pull request Sep 8, 2026
A class name in a string is not a name PHP ever checks. Every one that names a
class SMF ships is now written as a ::class resolver, so the compiler resolves it
against the file's imports and a misspelling stops being invisible.

Where the value is a callable or a name that other code parses, the class half
becomes a resolver and the rest stays a string, so every value is byte for byte
what it was. The upgrader's FetchSMfiles is the exception: writing it as a
resolver spells it the only way it can be spelled, which is the fix in #9660.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@Sesquipedalian

Copy link
Copy Markdown
Member

Superseded by #9665.

@Oldiesmann
Oldiesmann deleted the capital_f branch September 9, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants