Last modified: 2013-10-24 17:41:42 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 T57602, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55602 - ForeignApiRepo fails when using fopen with allow_url_fopen disabled
ForeignApiRepo fails when using fopen with allow_url_fopen disabled
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
1.22.0
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-11 00:00 UTC by OverlordQ
Modified: 2013-10-24 17:41 UTC (History)
5 users (show)

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


Attachments

Description OverlordQ 2013-10-11 00:00:53 UTC
I have allow_url_fopen disabled (for now) on my fresh wiki and while the install went find, trying to preview the first edit of the Main Page resulted in a MWException, turning on the usual debugging settings:

---
error_reporting( -1 );
ini_set( 'display_errors', 1 );
$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
---

caused a jumbled/corrupted/improperly handled Exception to occur which caused the page to render improperly.
Comment 1 OverlordQ 2013-10-11 00:06:17 UTC
Looking further it seems it's because wgDebugToolbar isn't doing what it should, the toolbar is missing.
Comment 2 Andre Klapper 2013-10-11 23:40:30 UTC
Hmm, so would it be possible to provide a stacktrace?
Comment 3 OverlordQ 2013-10-11 23:56:43 UTC
So I'm guessing it's because instant commons is enabled.  However, I dont rememeber ever seeing a warning during installation regarding this issue.


MWHttpRequest::factory: allow_url_fopen needs to be enabled for pure PHP http requests to work. If possible, curl should be used instead. See http://php.net/curl.

Backtrace:

#0 /www/wikicurean.com/html/w/includes/filerepo/ForeignAPIRepo.php(477): MWHttpRequest::factory('http://commons.wikimedia.org/w/api.php?titles=File%3AWikicurean.png&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime%7Cmediatype&prop=imageinfo&iimetadataversion=2&format=json&action=query&redirects=true&uselang=en', Array)
#1 /www/wikicurean.com/html/w/includes/filerepo/ForeignAPIRepo.php(508): ForeignAPIRepo::httpGet('http://commons.wikimedia.org/w/api.php?titles=File%3AWikicurean.png&iiprop=timestamp%7Cuser%7Ccomment%7Curl%7Csize%7Csha1%7Cmetadata%7Cmime%7Cmediatype&prop=imageinfo&iimetadataversion=2&format=json&action=query&redirects=true&uselang=en')
#2 /www/wikicurean.com/html/w/includes/filerepo/ForeignAPIRepo.php(183): ForeignAPIRepo->httpGetCached('Metadata', Array)
#3 /www/wikicurean.com/html/w/includes/filerepo/file/ForeignAPIFile.php(61): ForeignAPIRepo->fetchImageQuery(Array)
#4 (): ForeignAPIFile::newFromTitle(Object(Title), Object(ForeignAPIRepo))
#5 /www/wikicurean.com/html/w/includes/filerepo/FileRepo.php(333): call_user_func(Array, Object(Title), Object(ForeignAPIRepo))
#6 /www/wikicurean.com/html/w/includes/filerepo/ForeignAPIRepo.php(103): FileRepo->newFile(Object(Title), false)
#7 /www/wikicurean.com/html/w/includes/filerepo/FileRepo.php(362): ForeignAPIRepo->newFile(Object(Title))
#8 /www/wikicurean.com/html/w/includes/filerepo/RepoGroup.php(151): FileRepo->findFile(Object(Title), Array)
#9 /www/wikicurean.com/html/w/includes/GlobalFunctions.php(3542): RepoGroup->findFile(Object(Title), Array)
#10 /www/wikicurean.com/html/w/includes/parser/Parser.php(3865): wfFindFile(Object(Title), Array)
#11 /www/wikicurean.com/html/w/includes/parser/Parser.php(3830): Parser->fetchFileNoRegister(Object(Title), Array)
#12 /www/wikicurean.com/html/w/includes/parser/Parser.php(5320): Parser->fetchFileAndTitle(Object(Title), Array)
#13 /www/wikicurean.com/html/w/includes/parser/Parser.php(2080): Parser->makeImage(Object(Title), 'link=|center|400px', Object(LinkHolderArray))
#14 /www/wikicurean.com/html/w/includes/parser/Parser.php(1818): Parser->replaceInternalLinks2('a whole lot of HTML output here', Object(Title), Object(ParserOptions), true, true, 10)
#18 /www/wikicurean.com/html/w/includes/WikiPage.php(3539): WikitextContent->getParserOutput(Object(Title), 10, Object(ParserOptions))
#19 /www/wikicurean.com/html/w/includes/PoolCounter.php(222): PoolWorkArticleView->doWork()
#20 /www/wikicurean.com/html/w/includes/Article.php(708): PoolCounterWork->execute()
#21 /www/wikicurean.com/html/w/includes/actions/ViewAction.php(44): Article->view()
#22 /www/wikicurean.com/html/w/includes/Wiki.php(448): ViewAction->show()
#23 /www/wikicurean.com/html/w/includes/Wiki.php(312): MediaWiki->performAction(Object(Article), Object(Title))
#24 /www/wikicurean.com/html/w/includes/Wiki.php(602): MediaWiki->performRequest()
#25 /www/wikicurean.com/html/w/includes/Wiki.php(467): MediaWiki->main()
#26 /www/wikicurean.com/html/w/index.php(49): MediaWiki->run()
#27 {main}
Comment 4 Chad H. 2013-10-12 00:05:28 UTC
Retitling bug based on issue. It seems kind of duh since PHP is acting as designed (we can't use fopen-type functions when allow_url_fopen is disabled).

So what we should do is twofold:

1) ForeignApiRepo should detect this case and bail more gracefully (with appropriate debug logging of course)

2) We need to warn about the whole situation much better in the installer. Life without curl is miserable, so we should stress that installing it is a Good Thing. When it's not there though, we should at least prevent the installing admin from enabling instant commons since it's just shooting yourself in the foot.

OverlordQ: For now either disable instant commons or enable allow_url_fopen.
Comment 5 OverlordQ 2013-10-12 00:20:34 UTC
Yeah, I just installed php5-curl, and as an aside, the DebugToolbar was missing because I'm using varnish and wgUseSquid is enabled which turns the debugtoolbar off. Makes sense in hindsight, but had to dig through code to find it out.

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


Navigation
Links