Page MenuHomePhabricator

Missing skins/common/images/icons/fileicon.png causes fatal PHP error when viewing file pages for files that can't be thumbnailed
Open, MediumPublic

Description

If certain skin images (such as skins/common/images/icons/fileicon-pdf.png are missing then MediaWiki throws a Fatal PHP error when trying to view the relevant file page.

PHP Fatal error: Call to a member function toHtml() on a non-object in w/includes/ImagePage.php on line 505


Version: 1.23.1
Severity: minor

Details

Reference
bz67422

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 3:27 AM
bzimport set Reference to bz67422.
bzimport added a subscriber: Unknown Object (MLST).

Obviously the fix is to make sure all of the images are there; however, there aren't any useful error messages, or attempts to display a broken image link or something. Just various forms of the "Call to member function X on a non-object. I only found that the icon image was missing on a wild guess.

It only files if the file 'fileicon.png' doesn't exist, either. As the code doesn't actually ever read it, it would make sense not to fail like this.

(In reply to Bartosz Dziewoński from comment #2)

It only files

It only *fails*. :)

Change 143646 had a related patch set uploaded by Bartosz Dziewoński:
Do not fatal if skins/common/images/icons/fileicon.png doesn't exist

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

(In reply to Bartosz Dziewoński from comment #2)

It only files if the file 'fileicon.png' doesn't exist, either. As the code
doesn't actually ever read it, it would make sense not to fail like this.

The server may not read the file right then and there, but it sure is used. In this case by the user via the web server directly.

It's still a very valid error. It should be surfaced in a better way though. Perhaps in the mediawiki error log, or by throwing an explicit exception?

Change 143646 abandoned by Bartosz Dziewoński:
Do not fatal if skins/common/images/icons/fileicon.png doesn't exist

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