From 63ae71c8f942a54322485d82931f2a5766560407 Mon Sep 17 00:00:00 2001 From: Rafid Aslam Date: Wed, 3 Jan 2018 09:37:07 +0700 Subject: [PATCH] TitleBlacklistPreAuthenticationProvider: Add null assert $req can legitimately be null, so we need to add null to the assert as well, so the code doesn't stop immediately. This is a follow-up for I83f9374b2f3236097860f4aecc694326b891905b Change-Id: I85dbc1b4c1452d0671879e6cc02c5411090b1d1d --- TitleBlacklistPreAuthenticationProvider.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/TitleBlacklistPreAuthenticationProvider.php b/TitleBlacklistPreAuthenticationProvider.php index aaea0186..8c737bae 100644 --- a/TitleBlacklistPreAuthenticationProvider.php +++ b/TitleBlacklistPreAuthenticationProvider.php @@ -34,9 +34,13 @@ class TitleBlacklistPreAuthenticationProvider extends AbstractPreAuthenticationP $req = AuthenticationRequest::getRequestByClass( $reqs, TitleBlacklistAuthenticationRequest::class ); // For phan check, to ensure that $req is instance of \TitleBlacklistAuthenticationRequest - assert( $req instanceof TitleBlacklistAuthenticationRequest ); + // or null + if ( $req instanceof TitleBlacklistAuthenticationRequest ) { + $override = $req->ignoreTitleBlacklist; + } else { + $override = false; + } - $override = $req && $req->ignoreTitleBlacklist; return TitleBlacklistHooks::testUserName( $user->getName(), $creator, $override, true ); }