aboutsummaryrefslogtreecommitdiffstats
path: root/includes/Permissions
diff options
context:
space:
mode:
authordaniel <dkinzler@wikimedia.org>2023-10-10 22:07:24 +0200
committerDaniel Kinzler <dkinzler@wikimedia.org>2023-10-11 11:02:40 +0000
commitb88cd15be3de1268e3352e9fff6ffacc84a1d960 (patch)
tree7f1c679e4696ae63e472a3e2ca5144dac29e1d7d /includes/Permissions
parentf7049ef7ffacc34b3c5d2e4332b3aa3a2e582aba (diff)
downloadmediawikicore-b88cd15be3de1268e3352e9fff6ffacc84a1d960.tar.gz
mediawikicore-b88cd15be3de1268e3352e9fff6ffacc84a1d960.zip
ActionFactory: don't choke on special pages
ActionFactory (and by extension, PermissionManager) should behave gracefully when asked to determine whether an action requires the user to be unblocked on a special page. Actions are not defined for special pages, but we should not fail hard when encountering a special page as context. This is particularly important since getActionInfo will fall back to Title::newMainPage whn no context is provided, and some wikis (e.g. Meta) use a special page as their main page. This should be considered a workaround until we have resolved T346036. Bug: T348451 Followup-To: Ic30c36f82ab142130b5f4167c13284aeed899231 Change-Id: Ia301ac1f2e3fd812fd63aea83098cbc0270b80cc
Diffstat (limited to 'includes/Permissions')
-rw-r--r--includes/Permissions/PermissionManager.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/Permissions/PermissionManager.php b/includes/Permissions/PermissionManager.php
index 4f460279be0e..fd54f369a700 100644
--- a/includes/Permissions/PermissionManager.php
+++ b/includes/Permissions/PermissionManager.php
@@ -950,6 +950,8 @@ class PermissionManager {
// If no ActionInfo is returned, assume that the action requires unblock
// which is the default.
+ // NOTE: We may get null here even for known actions, if a wiki's main page
+ // is set to a special page, e.g. Special:MyLanguage/Main_Page (T348451, T346036).
if ( !$actionInfo || $actionInfo->requiresUnblock() ) {
if (
( !$page || $this->isBlockedFrom( $user, $page, $useReplica ) ) ||