[3.0] Passes fatalLang() its arguments in the right order - #9343
Merged
jdarwood007 merged 1 commit intoAug 2, 2026
Conversation
fatalLang() takes ($error, $log, $sprintf, $status). Calendar.php puts the HTTP status where $sprintf goes in all 27 of its calls, and Themes.php hands that parameter a bare string. Under strict_types every one of those is a TypeError, so the calendar never reports a problem it means to report: an invalid month or day, a topic that is not yours, a missing event title, or the calendar simply being switched off all end in "Argument #3 ($sprintf) must be of type array" instead of the message that was written for them. The status codes were the default 403 or plain 400, so nothing is lost by moving them into the slot they belong in. Sources/Forum.php, Topic.php and HelpAdmin.php already show the intended shape: fatalLang('not_found', false, [], 404). Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
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
Sources/Actions/Calendar.phpputs the HTTP status in the third slot in all 27 of its calls:Under
strict_typesevery one of those is a TypeError, so the calendar never delivers a single one of the messages it means to deliver. It reports this instead:Which covers the calendar being switched off, an invalid month, year, day or date, a missing event title, a topic that is not yours, a missing topic ID, an out-of-range number of days, and the iCal export being disabled. All of them end in a 500 and the generic "An error has occurred" instead of the written explanation and the right status code.
Sources/Actions/Admin/Themes.phphas the same mistake in a different shape: it hands$sprintfa bare string wherepackage_get_error_theme_no_based_on_foundwants{0}filled in, so installing a theme that depends on a missing base theme fails with a TypeError rather than naming the theme you need.The status codes involved were either the default 403 or a plain 400, so nothing is lost by moving them into the parameter they belong in.
Sources/Forum.php,Sources/Topic.phpandSources/Actions/HelpAdmin.phpalready show the intended shape:Testing
Docker environment, PostgreSQL 17, calendar toggled on and off.
?action=calendar, calendar off?action=calendar;month=5;year=1800?action=calendar;sa=ical, export off?action=calendar;sa=postwithout permission?action=calendarnormallyError log empty across the run.
vendor/bin/phpunit— 108 tests, 157 assertions, OK.Found while checking what the PostgreSQL error reporting in #9341 exposed. Not a query failure, and unrelated to that change.
Issues References (Fixes|Related|Closes)
Related to #9341