Last modified: 2010-05-15 15:33:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T3805, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1805 - new User() objects see undefined $wgContLang due to early call of loadfromsession() in Setup.php
new User() objects see undefined $wgContLang due to early call of loadfromses...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
User login and signup (Other open bugs)
1.4.x
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: code_quality 1360
  Show dependency treegraph
 
Reported: 2005-04-02 22:17 UTC by T. Gries
Modified: 2010-05-15 15:33 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description T. Gries 2005-04-02 22:17:48 UTC
I think, but I am not fully sure, to have found a problem in setup.php which
could lead to undefined $wgContLang object under certain circumstances; pls.
correct me if I'm wrong.

The following part in setup.php can call User:loadFromSession() -- which can(!)
create a new User() w/o going via   SpecialUserLogin -- without the proper or
provisional language settings, which leads to $wgContLang being undefined and to
some undefined user account settings. 

I noticed this behaviour while playing with AuthPlugin.php, Auth->InitUser(),
User->InitUser and User->loadfromsession().


if( $wgCommandLineMode ) {
	# Used for some maintenance scripts; user session cookies can screw things up
	# when the database is in an in-between state.
	$wgUser = new User();
} else {
	$wgUser = User::loadFromSession();
}

I propose to move these lines in setup.php just a couple of lines below: AFTER
the language setting
This can be seen in  attachment
http://bugzilla.wikimedia.org/attachment.cgi?id=398 [for
http://bugzilla.wikipedia.org/show_bug.cgi?id=1360 ] or here:

@@ -290,6 +291,14 @@
 $wgContLang = setupLangObj( $wgContLangClass );
 $wgContLang->initEncoding();
 
+if( $wgCommandLineMode ) {
+	# Used for some maintenance scripts; user session cookies can screw things up
+	# when the database is in an in-between state.
+	$wgUser = new User();
+} else {
+	$wgUser = User::loadFromSession();
+}
+
Comment 1 Brion Vibber 2005-06-16 07:53:53 UTC
Removing from 1.5 blockers as nothing in 1.5 should actually be affected by it; the language 
object is only hit for default settings for anon users, and there was a hackaround for that which 
worked already.

Moving to code quality (bug 700) instead, and resolving as FIXED for 1.5 in CVS HEAD.
Comment 2 T. Gries 2005-09-11 18:49:14 UTC
Also reported as http://bugzilla.wikimedia.org/show_bug.cgi?id=3426 Variable
wgContLang is null in ObjectCache.php and Title.php. Not sure, whether it is a
real duplicate.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links