Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/304628

Change subject: Don't pass null as 1st parameter to 
SpecialMobileHistory::shouldUseSpecialHistory()
......................................................................

Don't pass null as 1st parameter to 
SpecialMobileHistory::shouldUseSpecialHistory()

IContextSource::getTitle() can, according to it's documentation, return null
instead of a Title object, which would result in a fatal error, as
SpecialMobileHistory::shouldUseSpecialHistory() type hints to Title for the 
first
parameter.

This change adds a check for $title === null before passing the Title to the
named function.

Bug: T142914
Change-Id: Ib3d7549305fa17f75bf51635b82b5d5432e90ab4
---
M includes/MobileContext.php
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/28/304628/1

diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 854517e..aa31c11 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -418,9 +418,12 @@
                }
 
                if ( $request->getVal( 'action' ) === 'history' &&
+                       // IContextSource::getTitle() can be null
+                       $title !== null &&
                        // check, if SpecialMobileHistory supports the history 
action set for this title
                        // content model
-                       SpecialMobileHistory::shouldUseSpecialHistory( $title ) 
) {
+                       SpecialMobileHistory::shouldUseSpecialHistory( $title )
+               ) {
                        $values = $this->getRequest()->getValues();
                        // avoid infinite redirect loops
                        unset( $values['action'] );

-- 
To view, visit https://gerrit.wikimedia.org/r/304628
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib3d7549305fa17f75bf51635b82b5d5432e90ab4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to