Last modified: 2014-09-08 16:43:03 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 T55820, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 53820 - PHP Fatal error: Call to a member function parseParamString() on a non-object in SpecialUploadStash.php on line 137
PHP Fatal error: Call to a member function parseParamString() on a non-object...
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.22.0
All All
: High normal (vote)
: ---
Assigned To: Gilles Dubuc
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-05 18:45 UTC by Sam Reed (reedy)
Modified: 2014-09-08 16:43 UTC (History)
8 users (show)

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


Attachments

Description Sam Reed (reedy) 2013-09-05 18:45:04 UTC
[05-Sep-2013 13:55:08] Fatal error: Call to a member function parseParamString() on a non-object at /usr/local/apache/common-local/php-1.22wmf15/includes/specials/SpecialUploadStash.php on line 137
Server: mw1178
Method: GET
URL: http://commons.wikimedia.org/wiki/Special:UploadStash/thumb/11p7ilv5g0zk.psleb4.1113395.jpg/500px-11p7ilv5g0zk.psleb4.1113395.jpg
Backtrace:
#0 /usr/local/apache/common-local/php-1.22wmf15/includes/specials/SpecialUploadStash.php(137): SpecialUploadStash::parseKey()
#1 /usr/local/apache/common-local/php-1.22wmf15/includes/specials/SpecialUploadStash.php(85): SpecialUploadStash->parseKey('thumb/11p7ilv5g...')
#2 /usr/local/apache/common-local/php-1.22wmf15/includes/specials/SpecialUploadStash.php(69): SpecialUploadStash->showUpload('thumb/11p7ilv5g...')
#3 /usr/local/apache/common-local/php-1.22wmf15/includes/SpecialPage.php(631): SpecialUploadStash->execute('thumb/11p7ilv5g...')
#4 /usr/local/apache/common-local/php-1.22wmf15/includes/SpecialPageFactory.php(490): SpecialPage->run('thumb/11p7ilv5g...')
#5 /usr/local/apache/common-local/php-1.22wmf15/includes/Wiki.php(291): SpecialPageFactory::executePath(Object(Title), Object(RequestContext))
#6 /usr/local/apache/common-local/php-1.22wmf15/includes/Wiki.php(588): MediaWiki->performRequest()
#7 /usr/local/apache/common-local/php-1.22wmf15/includes/Wiki.php(459): MediaWiki->main()
#8 /usr/local/apache/common-local/php-1.22wmf15/index.php(55): MediaWiki->run()
#9 /usr/local/apache/common-local/w/index.php(3): require('/usr/local/apac...')
Comment 1 Bryan Davis 2013-09-05 19:17:30 UTC
It looks like $handler could be boolean false via MediaHandler::getHandler() if $wgMediaHandlers[$type] is not found.

$handler is derived via a long chain of object lookups/calls:

  RepoGroup::singleton()->getLocalRepo()->getUploadStash()->getFile()->getHandler()

I would expect to see a wfDebug() of "MediaHandler::getHandler: no handler found for X" just before this crash. "X" would be the mime type that MimeMagic::singleton()->guessMimeType() is returning for the local file.
Comment 2 Bryan Davis 2013-09-05 19:28:32 UTC
File::getHandler() should probably check the return value of MediaHandler::getHandler() and raise an MWException when it === false.
Comment 3 Bawolff (Brian Wolff) 2013-09-05 19:30:09 UTC
Interesting. The file has extension jpg. Stashed files should get their ext from detected mime type, which means mime type should def be image/jpeg, which is a built in handler and should always be found. (Otoh maybe my memory of how upload stash works is wrong. In any case code should never assume that all files have a handler)
Comment 4 Gerrit Notification Bot 2013-09-05 20:50:01 UTC
Change 83010 had a related patch set uploaded by BryanDavis:
Assert that $this->handler is not false.

https://gerrit.wikimedia.org/r/83010
Comment 5 Bryan Davis 2013-09-05 21:02:16 UTC
UploadStash::getFile() returns an UnregisteredLocalFile subclass which in turn derives mime type via MimeMagic::guessMimeType(). Looking there you can see that the first guess is made via magic header checks with a fallback to extension based guessing as Bawolff remembered.

There's a loophole in that fallback though that my money is on for this bug. MimeMagic::doGuessMimeType() will return 'unknown/unknown' if the file can't be opened for reading. Based on some of the other bugs I've been chasing this week, my guess is that the stashed file is actually missing from disk.
Comment 6 Gerrit Notification Bot 2013-09-17 17:22:46 UTC
Change 83010 merged by jenkins-bot:
Guard against non-object returns from File::getHander()

https://gerrit.wikimedia.org/r/83010
Comment 7 Mark Holmquist 2013-09-19 18:33:58 UTC
Bryan's patch makes this easier to debug, but it's not fixed. Assigning.
Comment 8 Bryan Davis 2013-09-19 18:36:47 UTC
The patch fixes the php fatal error, but not whatever underlying problem caused it. The patch will raise an exception with a hopefully informative message if this error path is encountered again.
Comment 9 Tisza Gergő 2014-01-08 19:13:43 UTC
Shouldn't you just not return any params if there is no handler? Not all file types have a handler, this should not be an error condition.
Comment 10 Gilles Dubuc 2014-09-08 16:43:03 UTC
No trace of the exception in the last 30 days on logstash nor in the fluorine archives, which go as far back as mid-March.

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


Navigation
Links