-----Original Message----- From: mediawiki-l-bounces@Wikimedia.org [mailto:mediawiki-l-bounces@Wikimedia.org]On Behalf Of Brion Vibber Sent: Saturday, April 30, 2005 6:08 AM To: MediaWiki announcements and site admin list Subject: Re: [Mediawiki-l] AuthPlugin always fails with fatal erroron initialauthentication
Carlton B wrote:
It doesn't look like that should be possible, though, unless your plugin's initUser method (which is called from LoginForm's to optionally modify the user object before it's saved) looks something like this:
function initUser( &$u ) { $u = 'This will break'; }
If you're modifying the user object in that method, make sure you're not replacing it with a non-object.
Actually I didn't override this method at all. However, looking at the code, that is precisely the problem. SpecialUserlogin.php requires initUser() to return a reference to the user object.
No, I checked this carefully when trying to reproduce your problem (and successfully doing it only with the above code) -- it requires **LoginForm::initUser** to return a reference. **AuthPlugin::initUser** is a different function and doesn't return anything, and its return value if any is never used.
Well, in this case I guess we've just got different things going on, because I didn't override AuthPlugin::initUser and I didn't modify LoginForm::initUser or tamper with SpecialUserlogin.php in any way. The only way I could get AuthPlugin to do an autocreate without throwing the fatal error was by overriding AuthPlugin::initUser to return the reference to the user it was passed. I wonder if your reproduction was accurate, because this is a tricky bug - even though it does throw a fatal error, the new user account indeed does get created, and the problem will not repeat itself as long as the user exists in the MW database.
I have gone back through your code explanation and I can't find any fault with it. The only remaining possibilities I can think of are: 1) Some method of the User class is setting the object to null in LoginForm::initUser 2) PHP is getting its namespace confused and calling LoginForm::initUser instead of AuthPlugin::initUser on line 254 of SpecialUserLogin.php. Perhaps it's my version of PHP. I am on php 4.3.11.
Frankly I do not trust PHP 4's OO strategy to correctly handle any remote similarities in the namespace, so maybe renaming the AuthPlugin::initUser interface to something else show this to be the case. Is this interface widely referenced elsewhere, can I safely rename it on line 254 of SpecialUserLogin.php and then change it to the same in my AuthUser extension?
Thanks.. -Carlton