multidimension-al / phpbbauth

A Mediawiki extension for phpBB authentication using Auth_remoteuser.
MIT License
5 stars 5 forks source link

Incompatibility with phpBB 3.0? Or is something up with Auth_remoteuser...? #8

Closed adriweb closed 5 years ago

adriweb commented 5 years ago

Hi,

Context: I'm using the latest version of this extension and a Mediawiki instance in version 1.30 and all my extensions in their latest versions (or REL1_30 when needed). My wiki and forums are on different subdomains (which may cause some cookie issues from what I've read? But I'm not 100% sure, and anyway if need be I can change my phpBB code).

The readme says it should work fine with phpBB 3.0+, but I guess it should be 3.2+, because of the $request->enable_super_globals(); call that's not available in earlier versions AFAICS.

But anyway, I've tried commenting out that call in order to try to go further. It should be fine anyway since phpbb 3.0 had them enabled by default (and they were deactivated in phpbb 3.1.x).

Right now, I have this error when loading any page:

[...] PHP Fatal error:  Call to undefined method user::newFromName() in [...]/wiki/includes/session/UserInfo.php on line 103

I've checked that the $user phpBB variable is correct and the $wgAuthRemoteuser... variables seem correct as well.

Any idea what could be done?

ajquick commented 5 years ago

Good point. What version of phpBB are you using now?

adriweb commented 5 years ago

Oops, I should have written that elsewhere than just in the title... It's basically phpBB 3.0.9, with some custom code mods and security backports from upstream. Nothing that should interfere with auth though.

BTW, I'm using this extension after I upgraded from MW 1.25+the old phpbbsso extension.

adriweb commented 5 years ago

Also, regarding the redirect URL, don't worry, I have the real url under the same domain but an URL rewrite that puts it in the other, so at worst I can just use the real one. But I'm not there yet ^^'

ajquick commented 5 years ago

I just pushed a commit that should take care of the superglobals problem on versions before phpBB 3.1. https://github.com/multidimension-al/phpbbauth/commit/d15a92ecd436cbc201402515f74a3794684fdbef

The other issue however must be related to problems with Auth_remote user and Mediawiki. Are you 100% sure you have updated your Wiki source code to 1.30?

UserInfo::newFromName should exist in 1.27+ if not in earlier versions. I suspect it is possible you have some older code on your Wiki.

ajquick commented 5 years ago

Also, regarding the redirect URL, don't worry, I have the real url under the same domain but an URL rewrite that puts it in the other, so at worst I can just use the real one.

I think on the version of phpBB you are running, you won't encounter the redirect problem.

Cookies should also not be a problem if you are using the correct settings in phpBB that would apply the cookie to all subdomains as well as the regular domain.

adriweb commented 5 years ago

I just pushed a commit that should take care of the superglobals problem on versions before phpBB 3.1. d15a92e

Yep, I guess that works too, thanks :)

The other issue however must be related to problems with Auth_remote user and Mediawiki. Are you 100% sure you have updated your Wiki source code to 1.30? UserInfo::newFromName should exist in 1.27+ if not in earlier versions. I suspect it is possible you have some older code on your Wiki.

Oh, absolutely, it's actually a brand new install where I copied over (and updated) my LocalSettings.php and launched the DB update script. If you want to take a look at the versions and extensions I have: https://wiki.tiplanet.org/Sp%C3%A9cial:Version (phpbbauth not loaded)

Maybe what's happening is that some of phpBB's global variables (pre-3.2 (or 3.1?) things weren't namespaced...) are overwriting MW's. Possibly the User class or something? And https://github.com/wikimedia/mediawiki/blob/REL1_30/includes/session/UserInfo.php#L26 may not be the correct one, hmmm. I guess I'd have to debug that.

adriweb commented 5 years ago

I think on the version of phpBB you are running, you won't encounter the redirect problem.

Alright, cool, thanks.

Cookies should also not be a problem if you are using the correct settings in phpBB that would apply the cookie to all subdomains as well as the regular domain.

Yeah, just checked, they're good. Valid on all subdomains and readable from the wiki's.

ajquick commented 5 years ago

Maybe what's happening is that some of phpBB's global variables (pre-3.2 (or 3.1?) things weren't namespaced...) are overwriting MW's. Possibly the User class or something? And https://github.com/wikimedia/mediawiki/blob/REL1_30/includes/session/UserInfo.php#L26 may not be the correct one, hmmm. I guess I'd have to debug that.

That's most likely it. Unfortunately phpBB didn't really implement namespaces until 3.2 I guess. I think you may be right that the phpbbauth plugin will not work on versions prior to phpBB 3.2. I would suspect though, that if the plugin were in class, that perhaps we could fix this by preventing the conflict between phpBB's user class and MediaWiki's user class.

Any ideas, suggestions?

adriweb commented 5 years ago

Well, your ideas are as good as mine if not better :D I've worked with phpBB 3.0 code for quite a few years now, but never in MW's, so heh.

I'll at least first try to locate any overwriting and see what we could possibly do about it...

adriweb commented 5 years ago

Right, [at least] the User class got overwritten by phpBB's user (sigh, it's even a different case...), just confirmed that. Now to check if we can mess with scopes to do things differently...

adriweb commented 5 years ago

Yeah.... it's not going to work :P Too bad, I guess it'll need namespaces, so phpBB 3.2+.

In my case, I've bypassed all that by not requiring phpBB files, I just queried the DB to fill the appropriate fields needed for Auth_remoteuser :)

Thanks for the help!

ajquick commented 5 years ago

If I can figure out a fix (that works with all 3.0+ installs), I'll let you know.