Page MenuHomePhabricator

Linker::processResponsiveImages: Call to a member function getUrl() on a non-object at /includes/Linker.php on line 918
Closed, ResolvedPublic

Description

Spotted on beta, first occurrence on [06-Dec-2013 19:07:33]

Can be reproduced by browsing http://en.wikipedia.beta.wmflabs.org/wiki/Wikipedia:Featured_pictures

[06-Dec-2013 19:07:33] Fatal error: Call to a member function getUrl() on a non-object at /data/project/apache/common-local/php-master/includes/Linker.php on line 918
Server: i-0000031a
Method: GET
URL: http://en.wikipedia.beta.wmflabs.org/wiki/Wikipedia:Featured_pictures
Backtrace:
#0 /data/project/apache/common-local/php-master/includes/Linker.php(918): Linker::processResponsiveImages()
#1 /data/project/apache/common-local/php-master/includes/Linker.php(677): Linker::processResponsiveImages(Object(ForeignAPIFile), Object(ThumbnailImage), Array)
#2 /data/project/apache/common-local/php-master/includes/parser/Parser.php(5482): Linker::makeImageLink(Object(Parser), Object(Title), Object(ForeignAPIFile), Array, Array, false, false, 4)
#3 /data/project/apache/common-local/php-master/includes/parser/Parser.php(2088): Parser->makeImage(Object(Title), '150px', Object(LinkHolderArray))
#4 /data/project/apache/common-local/php-master/includes/parser/Parser.php(1825): Parser->replaceInternalLinks2('?:''"WP:FP" red...')
#5 /data/project/apache/common-local/php-master/includes/parser/Parser.php(1230): Parser->replaceInternalLinks('[[Category:Wiki...')
#6 /data/project/apache/common-local/php-master/includes/parser/Parser.php(395): Parser->internalParse('{{pp-semi|small...')
#7 [internal function]: Parser->parse('{{pp-semi|small...', Object(Title), Object(ParserOptions), true, true, 38155)
#8 /data/project/apache/common-local/php-master/includes/StubObject.php(99): call_user_func_array(Array, Array)
#9 /data/project/apache/common-local/php-master/includes/StubObject.php(119): StubObject->_call('parse', Array)
#10 /data/project/apache/common-local/php-master/includes/content/WikitextContent.php(306): StubObject->__call('parse', Array)
#11 /data/project/apache/common-local/php-master/includes/content/WikitextContent.php(306): StubObject->parse('{{pp-semi|small...', Object(Title), Object(ParserOptions), true, true, 38155)
#12 /data/project/apache/common-local/php-master/includes/WikiPage.php(3560): WikitextContent->getParserOutput(Object(Title), 38155, Object(ParserOptions))
#13 /data/project/apache/common-local/php-master/includes/PoolCounter.php(222): PoolWorkArticleView->doWork()
#14 /data/project/apache/common-local/php-master/includes/Article.php(708): PoolCounterWork->execute()
#15 /data/project/apache/common-local/php-master/includes/actions/ViewAction.php(44): Article->view()
#16 /data/project/apache/common-local/php-master/includes/Wiki.php(441): ViewAction->show()
#17 /data/project/apache/common-local/php-master/includes/Wiki.php(305): MediaWiki->performAction(Object(Article), Object(Title))
#18 /data/project/apache/common-local/php-master/includes/Wiki.php(596): MediaWiki->performRequest()
#19 /data/project/apache/common-local/php-master/includes/Wiki.php(460): MediaWiki->main()
#20 /data/project/apache/common-local/php-master/index.php(49): MediaWiki->run()
#21 /data/project/apache/common-local/w/index.php(3): require('/data/project/a...')
#22 {main}


Version: 1.23.0
Severity: normal

Details

Reference
bz58128

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:28 AM
bzimport set Reference to bz58128.
bzimport added a subscriber: Unknown Object (MLST).

I think Siebrand replaced some ->url field accesses with ->getUrl() calls recently.

Any theories on why this would be the cause? I don't know what error, if any, trying to access a class property on a non-object would cause. I'd expect a similar one (?).

The only thing I can think of is that maybe the thumbnail generation is failing. File::transform can return false on failure. If this is the case, then it makes sense that calling ->getUrl() would cause a fatal error (if you try just doing ->url on a variable that is false, it just gives a Notice).

If the above is true, then there may have been some lurking bug in that code that we had no idea about until this change, because the Linker code does not seem to be doing any error checking. ;)

Change 100369 had a related patch set uploaded by Siebrand:
Prevent fatal when Fiel::transform() returns false

https://gerrit.wikimedia.org/r/100369

Don't know if this made it into 1.23wmfX. If yes, it should probably be backported.

Change 100369 merged by jenkins-bot:
Prevent fatal when File::transform() returns false

https://gerrit.wikimedia.org/r/100369