Page MenuHomePhabricator

White page / Fatal Error after upgrade and succesfully update to 1.35: "Call to a member function getIP() on null"
Open, Needs TriagePublic

Description

Yesterday I made an upgrade from 1.23 to 1.35. After all steps in mw-config run correctly and the db-update was succefully finished, I got this fatal error:

Fatal error: Uncaught Error: 
Call to a member function getIP() on null in /www/htdocs/w0068779/subpages/otherfiles/dsa_wiki/includes/user/User.php:2153
Stack trace: 
#0 /wikipage/includes/session/SessionBackend.php(742): User->getName() 
#1 /wikipage/includes/session/SessionBackend.php(626): MediaWiki\Session\SessionBackend->save() 
#2 [internal function]: MediaWiki\Session\SessionBackend->MediaWiki\Session\{closure}() 
#3 /wikipage/vendor/wikimedia/scoped-callback/src/ScopedCallback.php(96): call_user_func_array(Object(Closure), Array) 
#4 /wikipage/vendor/wikimedia/scoped-callback/src/ScopedCallback.php(56): Wikimedia\ScopedCallback->__destruct() 
#5 /wikipage/includes/session/SessionManager.php(890): Wikimedia\ScopedCallback::consume(NULL) 
#6 /wikipage/includes/session/SessionManager.php(3 in /wikipage/includes/user/User.php on line 2153

Fatal error: Uncaught Error: 
Call to a member function getIP() on null in /wikipage/includes/user/User.php:2153 
Stack trace: 
#0 /wikipage/includes/session/SessionBackend.php(742): User->getName() 
#1 /wikipage/includes/session/SessionBackend.php(225): MediaWiki\Session\SessionBackend->save(true) 
#2 /wikipage/includes/session/SessionManager.php(478): MediaWiki\Session\SessionBackend->shutdown() 
#3 [internal function]: MediaWiki\Session\SessionManager->shutdown() 
#4 {main} thrown in /wikipage/includes/user/User.php on line 2153

My PHP version is 7.4.10 and the MySQL version is 5.7.28. The old version runs under PHP 7.0 but I updated it before I run mw-config.
I looked for other topics with similiar errors but it doesn't work. I posted it too on "Support_desk" but they send my to post it here.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 26 2020, 8:56 AM
Aklapper renamed this task from White page / Fatal Error after upgrade and succesfully update to 1.35 to White page / Fatal Error after upgrade and succesfully update to 1.35: "Call to a member function getIP() on null".Sep 26 2020, 9:09 AM
Aklapper edited projects, added MediaWiki-User-management; removed MW-1.35-notes.
Aklapper updated the task description. (Show Details)
Reedy added a subscriber: Reedy.Sep 26 2020, 12:12 PM

Out of interest, on what page do you see this?

First I see it at the index.php but if I check other pages in the wiki (articles or special pages etc), I get the same error.

Ok

The code seems to be suggesting MW can't setup the "web request"...

What webserver? How is your PHP linked/configured with the webserver? (fcgi, fpm etc?)

Not sure if it's actually a PHP 7.4 issue, but tagging incase

It's webspace from a hoster... which line from the "phpinfo" do you need?

Reedy added a comment.Sep 26 2020, 3:52 PM

Something like this, YMMV

Server API 	Apache 2.0 Handler

Server API FPM/FastCGI

The Screenshot is only a part of the info... I read in an other topic that it worked to set a "sys_temp_dir". I tried it yesterday but it doesn't work.

Reedy added a comment.Sep 26 2020, 6:59 PM

Another similar (but not quite the same) report on IRC too...

Fatal error: Uncaught Error: Call to a member function getIP() on null in /home/public_html/w/includes/user/User.php:2153 Stack trace:
#0 /home/public_html/w/includes/session/SessionBackend.php(742): User->getName()
#1 /home/public_html/w/includes/session/SessionBackend.php(626): MediaWiki\Session\SessionBackend->save()
#2 [internal function]: MediaWiki\Session\SessionBackend->MediaWiki\Session\{closure}()
#3 /home/public_html/w/vendor/wikimedia/scoped-callback/src/ScopedCallback.php(96): call_user_func_array(Object(Closure), Array) 
#4 /home/public_html/w/vendor/wikimedia/scoped-callback/src/ScopedCallback.php(56): Wikimedia\ScopedCallback->__destruct()
#5 /home/public_html/w/includes/session/SessionManager.php(890): Wikimedia\ScopedCallback::consume(NULL)
#6 /home/public_html/w/includes/session/SessionManager.php(220): MediaWiki\Session\SessionManager->getSessionFromInfo(Object(MediaWiki\Session\SessionInfo), Object(WebRequest))
#7 /home/public_html/ in /home/public_html/w/includes/user/User.php on line 2153

Fatal error: Uncaught Error: Call to a member function getIP() on null in /home/public_html/w/includes/user/User.php:2153 Stack trace: 
#0 /home/public_html/w/includes/session/SessionBackend.php(742): User->getName()
#1 /home/public_html/w/includes/session/SessionBackend.php(225): MediaWiki\Session\SessionBackend->save(true)
#2 /home/public_html/w/includes/session/SessionManager.php(478): MediaWiki\Session\SessionBackend->shutdown()
#3 [internal function]: MediaWiki\Session\SessionManager->shutdown()
#4 {main} thrown in /home/public_html/w/includes/user/User.php on line 2153a

And in that case, the user had a LocalSettings.php config dating back to 1.18... Using a newly generated LocalSettings did help.

So it seems to be possibly some issue related to some refactoring Tim (I think) offhand did a while ago, removing boilerplate code from LocalSettings that really shouldn't have been in there. I know it was a few years/releases ago, but when people haven't upgraded from old versions like 1.18 or 1.23.. It's not so much of a surprise that it's cropping up now.

I would have to dig up that commit (or series of commits). CC @tstarling incase he remembers offhand

In the meantime... @Archcoven Can you post a copy of your LocalSettings.php? Please remove all passwords, tokens etc (but just empty out the strings), and any other private information that might be in there. It might become fairly obvious as to what the problematic code is in LocalSettings.. And as such, this might be more of a Documentation issue than anything else

If this is the only problem, it should be enough to take the original LocalSettings from the upgrade-package and add the nessesary informations... I hope it is so easy.

Reedy added a comment.EditedSep 26 2020, 7:19 PM

Thanks!

Feel free to try too in the meantime, I'll have a proper look later. I think... offhand, it *might* be related to the inclusion of includes/DefaultSettings.php... Which I seem to remember is one of the things that was changed in previous releases

https://gist.github.com/tyteen4a03/c3f0e1b244118c64a2e52405a18b7598 is the IRC report one

<?php
# This file was automatically generated by the MediaWiki installer.
# If you make manual changes, please keep track in case you need to
# recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# http://www.mediawiki.org/wiki/Manual:Configuration_settings

# If you customize your file layout, set $IP to the directory that contains
# the other MediaWiki files. It will be used as a base to locate files.

// For debugging
error_reporting( E_ALL );
ini_set( 'display_errors', 1 );

if( defined( 'MW_INSTALL_PATH' ) ) {
	$IP = MW_INSTALL_PATH;
} else {
	$IP = dirname( __FILE__ );
}

$path = array( $IP, "$IP/includes", "$IP/languages" );
set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );

require_once( "$IP/includes/DefaultSettings.php" );

# If PHP's memory limit is very low, some operations may fail.
# ini_set( 'memory_limit', '20M' );

if ( $wgCommandLineMode ) {
	if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
		die( "This script must be run from the command line\n" );
	}
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;

$wgSitename         = "redacted";

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/w";
$wgArticlePath = "/wiki/$1";
$wgScriptExtension  = ".php";
#$wgUsePathInfo = true;
## UPO means: this is also a user preference option

$wgEnableEmail      = true;
$wgEnableUserEmail  = false; # UPO

$wgEmergencyContact = "tyteen4a03@thelastcode.io";
$wgPasswordSender = "noreply@zbots.space";

$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;

## Database settings
$wgDBtype           = "mysql";
$wgDBserver         = "localhost";
$wgDBname           = "redacted";
$wgDBuser           = "redacted";
$wgDBpassword       = "redacted";

# MySQL specific settings
$wgDBprefix         = "redacted_";

# MySQL table options to use during installation or update
$wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=binary";

## Shared memory settings
$wgMainCacheType = CACHE_ACCEL;

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
$wgUseImageMagick = true;

## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "C.UTF-8";

## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
# $wgHashedUploadDirectory = false;

## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
$wgUseTeX           = false;

$wgUseInstantCommons = false;
$wgBlockDisablesLogin = true;

$wgLocalInterwiki   = strtolower($wgSitename);

$wgLanguageCode = "en";

$wgSecretKey = 'redacted';

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
$wgDefaultSkin = 'vector';

## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";

// Implicit group for all visitors
$wgGroupPermissions['*']['createaccount']    = true;
$wgGroupPermissions['*']['read']             = true;
$wgGroupPermissions['*']['edit']             = false;
$wgGroupPermissions['*']['createpage']       = false;
$wgGroupPermissions['*']['createtalk']       = false;
$wgGroupPermissions['*']['writeapi']         = false;
//$wgGroupPermissions['*']['patrolmarks']      = false; // let anons see what was patrolled

// Implicit group for all logged-in accounts
$wgGroupPermissions['user']['read']             = true;
$wgGroupPermissions['user']['edit']             = true;
$wgGroupPermissions['user']['createpage']       = true;
$wgGroupPermissions['user']['createtalk']       = true;
$wgGroupPermissions['user']['writeapi']         = true;
$wgGroupPermissions['user']['upload']           = true;
$wgGroupPermissions['user']['reupload']         = true;
$wgGroupPermissions['user']['reupload-shared']  = true;
$wgGroupPermissions['user']['minoredit']        = true;
$wgGroupPermissions['user']['purge']            = true; // can use ?action=purge without clicking "ok"
$wgGroupPermissions['user']['sendemail']        = true;
$wgGroupPermissions['user']['wysiwyg'] = true;
$wgGroupPermissions['user']['oathauth-enable'] = true;
// Implicit group for accounts that pass $wgAutoConfirmAge
$wgGroupPermissions['autoconfirmed']['autoconfirmed'] = true;

// Users with bot privilege can have their edits hidden
// from various log pages by default
$wgGroupPermissions['bot']['bot']              = true;
$wgGroupPermissions['bot']['autoconfirmed']    = true;
$wgGroupPermissions['bot']['nominornewtalk']   = true;
$wgGroupPermissions['bot']['autopatrol']       = true;
$wgGroupPermissions['bot']['suppressredirect'] = true;
$wgGroupPermissions['bot']['apihighlimits']    = true;
$wgGroupPermissions['bot']['writeapi']         = true;
#$wgGroupPermissions['bot']['editprotected']    = true; // can edit all protected pages without cascade protection enabled

$wgGroupPermissions['bureaucrat']['usermerge'] = true;

// Most extra permission abilities go to this group
$wgGroupPermissions['sysop']['block']            = true;
$wgGroupPermissions['sysop']['createaccount']    = true;
$wgGroupPermissions['sysop']['delete']           = true;
$wgGroupPermissions['sysop']['bigdelete']        = true; // can be separately configured for pages with > $wgDeleteRevisionsLimit revs
$wgGroupPermissions['sysop']['deletedhistory']   = true; // can view deleted history entries, but not see or restore the text
$wgGroupPermissions['sysop']['deletedtext']      = true; // can view deleted revision text
$wgGroupPermissions['sysop']['undelete']         = true;
$wgGroupPermissions['sysop']['editinterface']    = true;
$wgGroupPermissions['sysop']['editusercss']      = true;
$wgGroupPermissions['sysop']['edituserjs']       = true;
$wgGroupPermissions['sysop']['import']           = true;
$wgGroupPermissions['sysop']['importupload']     = true;
$wgGroupPermissions['sysop']['move']             = true;
$wgGroupPermissions['sysop']['move-subpages']    = true;
$wgGroupPermissions['sysop']['move-rootuserpages'] = true;
$wgGroupPermissions['sysop']['patrol']           = true;
$wgGroupPermissions['sysop']['autopatrol']       = true;
$wgGroupPermissions['sysop']['protect']          = true;
$wgGroupPermissions['sysop']['proxyunbannable']  = true;
$wgGroupPermissions['sysop']['rollback']         = true;
$wgGroupPermissions['sysop']['upload']           = true;
$wgGroupPermissions['sysop']['reupload']         = true;
$wgGroupPermissions['sysop']['reupload-shared']  = true;
$wgGroupPermissions['sysop']['unwatchedpages']   = true;
$wgGroupPermissions['sysop']['autoconfirmed']    = true;
$wgGroupPermissions['sysop']['upload_by_url']    = true;
$wgGroupPermissions['sysop']['ipblock-exempt']   = true;
$wgGroupPermissions['sysop']['blockemail']       = true;
$wgGroupPermissions['sysop']['markbotedits']     = true;
$wgGroupPermissions['sysop']['apihighlimits']    = true;
$wgGroupPermissions['sysop']['browsearchive']    = true;
$wgGroupPermissions['sysop']['noratelimit']      = true;
$wgGroupPermissions['sysop']['movefile']         = true;
$wgGroupPermissions['sysop']['unblockself']      = true;
$wgGroupPermissions['sysop']['suppressredirect'] = true;
$wgGroupPermissions['sysop']['checkuser'] = true;
$wgGroupPermissions['sysop']['checkuser-log'] = true;
$wgGroupPermissions['sysop']['move']             = true;
$wgGroupPermissions['sysop']['move-subpages']    = true;
$wgGroupPermissions['sysop']['move-rootuserpages'] = true; // can move root userpages
$wgGroupPermissions['sysop']['deleterevision']  = true;
$wgGroupPermissions['sysop']['renameuser'] = true;
$wgGroupPermissions['sysop']['interwiki'] = true;

$wgDiff3 = "/usr/bin/diff3";

$wgShowExceptionDetails = true;
$wgCookieSetOnIpBlock = true;

# When you make changes to this configuration file, this will make
# sure that cached pages are cleared.
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );

$wgLogo = "/w/wiki.png";
$wgPFEnableStringFunctions = true;

$wgFileExtensions[] = 'svg';

# Plugins includes
// Abuse Filter
wfLoadExtension( 'AbuseFilter' );

$wgGroupPermissions['sysop']['abusefilter-modify'] = true;
$wgGroupPermissions['sysop']['abusefilter-log-detail'] = true;
$wgGroupPermissions['sysop']['abusefilter-view'] = true;
$wgGroupPermissions['sysop']['abusefilter-log'] = true;
$wgGroupPermissions['sysop']['abusefilter-privatedetails'] = true;
$wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true;
$wgGroupPermissions['sysop']['abusefilter-revert'] = true;
$wgAbuseFilterNotificationsPrivate = true; 

wfLoadExtension("AntiSpoof");
wfLoadExtension("UserMerge");

// UploadWizard

wfLoadExtension( 'UploadWizard' );
$wgExtensionFunctions[] = function() {
	$GLOBALS['wgUploadNavigationUrl'] = SpecialPage::getTitleFor( 'UploadWizard' )->getLocalURL();
	return true;
};
$wgApiFrameOptions = 'SAMEORIGIN';

# MW Bundled stuff

// ConfirmEdit
wfLoadExtensions([ 'ConfirmEdit', 'ConfirmEdit/QuestyCaptcha' ]);

$wgCaptchaQuestions =[
    'redacted' => "redacted",
    'redacted' => "redacted",
    'redacted' => "redacted",
];

//
wfLoadExtension('Cite');
wfLoadExtension('CiteThisPage');

wfLoadExtension('CategoryTree');

// WikiEditor
$wgDefaultUserOptions['wikieditor-preview'] = 1;
$wgDefaultUserOptions['wikieditor-publish'] = 1;
wfLoadExtension( 'WikiEditor' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'InputBox' );
wfLoadExtension( 'Interwiki' );
wfLoadExtension( 'LocalisationUpdate' );
$wgLocalisationUpdateDirectory = "$IP/cache";
wfLoadExtension( 'MultimediaViewer' );
wfLoadExtension( 'Nuke' );
wfLoadExtension( 'OATHAuth' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'Poem' );
wfLoadExtension( 'Renameuser' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'TitleBlacklist' );

// Vector skin install
wfLoadSkin("Vector");

wfLoadExtension( 'CodeEditor' );
$wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension

// MobileFrontend
wfLoadExtension( 'MobileFrontend' );
$wgMFAutodetectMobileView = true;
wfLoadSkin( 'MinervaNeue' );
$wgMFDefaultSkinClass = "SkinMinerva";
$wgMobileFrontendLogo = $wgLogo;
$wgMFEnableBeta = true;


wfLoadExtension("ReplaceText");
wfLoadExtension( 'SecureLinkFixer' );
//wfLoadExtension( 'VisualEditor' );
wfLoadExtension( 'TemplateData' );
wfLoadExtension('PageImages');
wfLoadExtension('TextExtracts');
Archcoven added a comment.EditedSep 26 2020, 7:43 PM

The same error like before after I tried the other "LocalSetting". The "DefaultSettings" I did not change because there was nothing I had to change in it...

Fatal error:
Uncaught Error: Call to a member function getIP() on null in /www/htdocs/w0068779/subpages/otherfiles/dsa_wiki/includes/user/User.php:2153
Stack trace:
#0 /wikipages/includes/session/SessionBackend.php(742): User->getName()
#1 /wikipages/includes/session/SessionBackend.php(626): MediaWiki\Session\SessionBackend->save()
#2 [internal function]: MediaWiki\Session\SessionBackend->MediaWiki\Session\{closure}()
#3 /wikipages/vendor/wikimedia/scoped-callback/src/ScopedCallback.php(96): call_user_func_array(Object(Closure), Array)
#4 /wikipages/vendor/wikimedia/scoped-callback/src/ScopedCallback.php(56): Wikimedia\ScopedCallback->__destruct()
#5 /wikipages/includes/session/SessionManager.php(890): Wikimedia\ScopedCallback::consume(NULL)
#6 /wikipages/includes/session/SessionManager.php(3 in /wikipages/includes/user/User.php on line 2153

Fatal error:
Uncaught Error: Call to a member function getIP() on null in /wikipages/includes/user/User.php:2153
Stack trace:
#0 /wikipages/includes/session/SessionBackend.php(742): User->getName()
#1 /wikipages/includes/session/SessionBackend.php(225): MediaWiki\Session\SessionBackend->save(true)
#2 /wikipages/includes/session/SessionManager.php(478): MediaWiki\Session\SessionBackend->shutdown()
#3 [internal function]: MediaWiki\Session\SessionManager->shutdown() #4 {main} thrown in /wikipages/includes/user/User.php on line 2153

Reedy added a comment.Sep 26 2020, 7:46 PM

You can definitely comment out the require/include of DefaultSettings.php from LocalSettings

Archcoven added a comment.EditedSep 26 2020, 7:52 PM

I did but no change... the same error like before. Can it be a problem by changeing the URL? But in all places there is a relative path... or did I forget something?

I try to install parallel the version 1.34 from my provider and try to copy only the image-files and update the database. Maybe the result is different.

Reedy added a comment.Sep 26 2020, 9:23 PM

All of this isn't needed:

if( defined( 'MW_INSTALL_PATH' ) ) {
    $IP = MW_INSTALL_PATH;
} else {
    $IP = dirname( __FILE__ );
}

$path = array( $IP, "$IP/includes", "$IP/languages" );
set_include_path( implode( PATH_SEPARATOR, $path ) . PATH_SEPARATOR . get_include_path() );

require_once( "$IP/includes/DefaultSettings.php" );

if ( $wgCommandLineMode ) {
    if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
        die( "This script must be run from the command line\n" );
    }
}
Archcoven added a comment.EditedSep 26 2020, 10:21 PM

Nothing changed.
I checked the database but it seems as if there are all tables correct.
And I tried to make a second install (different database, different folder) with 1.34 but there I did not get the offer to update the copied database... it overwrite all and clear the database.