Last modified: 2012-05-15 03:45:06 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 T32953, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30953 - Avatar upload page broken
Avatar upload page broken
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SocialProfile (Other open bugs)
unspecified
All All
: Normal major (vote)
: ---
Assigned To: Jack Phoenix
: patch, patch-reviewed
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-17 15:32 UTC by Gerard Boyers
Modified: 2012-05-15 03:45 UTC (History)
3 users (show)

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


Attachments
Proposed patch that converts Special:UploadAvatar to use more RequestContext stuff (3.39 KB, patch)
2011-09-17 16:00 UTC, Jack Phoenix
Details

Description Gerard Boyers 2011-09-17 15:32:20 UTC
Using MW 1.19-svn and having updated SocialProfile to current svn version, the Special:UploadAvatar page produces the following error:

Warning: Missing argument 1 for SpecialUploadAvatar::loadRequest(), called in [site]/includes/specials/SpecialUpload.php on line 177 and defined in [site]/extensions/SocialProfile/UserProfile/SpecialUploadAvatar.php on line 35

Fatal error: Call to a member function getUpload() on a non-object in [site]/includes/upload/UploadFromFile.php on line 21

See: http://www.grandtheftwiki.com/Special:UploadAvatar
Comment 1 Jack Phoenix 2011-09-17 15:42:26 UTC
I suppose the most obvious question here would be: why on Earth are you running trunk on a production wiki? :)

IIRC the issue you're seeing is related to the RequestContext stuff and its (more) widespread use in trunk; r96249 and the like. If you're feeling adventurous, feel free to try your hand at fixing it; if not, I'll look at this later on. [[mw:Manual:RequestContext.php]] suggests that RequestContext is available in 1.18, so maybe this can be fixed without coming up with awful backwards-compatibility hacks.
Comment 2 Jack Phoenix 2011-09-17 16:00:08 UTC
Created attachment 9068 [details]
Proposed patch that converts Special:UploadAvatar to use more RequestContext stuff

Maybe you could try the attached patch. I whipped it together really quick, based on r96249, and didn't test it. It looks like it should work, but I'm not too familiar with the RequestContext stuff yet. Please let me know whether it fixes the reported issue or not so that I can consider committing it.
Comment 3 Gerard Boyers 2011-09-17 16:22:26 UTC
We like to live on the edge? Using trunk is historical for us, as we needed to up to trunk to fix an issue a while back, and since then every time we see an issue, the first thing I try is svn up to see if it's been fixed since. Never had any huge problems, just little things like this.

Thanks for this - that patch seems to work at least partially, avatars upload fine but the page still throws the same error:

Warning:  Missing argument 1 for SpecialUploadAvatar::loadRequest(), called in [site]/includes/specials/SpecialUpload.php on line 177 and defined in [site]/extensions/SocialProfile/UserProfile/SpecialUploadAvatar.php on line 32
Comment 4 Jack Phoenix 2011-09-17 17:26:47 UTC
You should be able to fix that by changing the function definition so that it doesn't take the $request parameter. So change line 32 of extensions/SocialProfile/UserProfile/SpecialUploadAvatar.php from:

protected function loadRequest( $request ) {

to:

protected function loadRequest() {
Comment 5 Sumana Harihareswara 2011-12-23 18:53:19 UTC
Inferring that Jack Phoenix has reviewed this patch & marking patch as reviewed.  Gerard, have you tried Jack's suggestion in comment 4 ?
Comment 6 Scott Duensing 2012-05-07 01:24:53 UTC
I am also running MW 1.19.0 and have applied the posted patch.  I also change the function definition.  I no longer get an error, but the upload doesn't do anything either.  There are no errors in my logs.  What can I do to diagnose this?

Thanks!
Comment 7 Jack Phoenix 2012-05-15 03:45:06 UTC
In my defense the patch I posted here worked perfectly...when I posted it. Which was many, many months ago.

The big deal here was that as of MediaWiki 1.19.0, the SpecialUpload class (the base class for Special:Upload, which Special:UploadAvatar also extends, because extending is easier than duplicating lots and lots of code) unconditionally requires that the edit token is present. UploadAvatar was not passing the edit token as it wasn't required before, and what you were seeing was an upload silently failing.

I've fixed this in SVN r115379 by applying the patch I posted here and by copypasting a few lines of code from includes/HTMLForm.php. Nasty, but it did the trick.

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


Navigation
Links