Page MenuHomePhabricator

Call to a member function getModel() on a non-object
Closed, ResolvedPublic

Description

content hidden as private in Bugzilla


Version: unspecified
Severity: major

Details

Reference
bz41128

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 12:55 AM
bzimport set Reference to bz41128.

[17-Oct-2012 18:47:55] Fatal error: Call to a member function getModel() on a
non-object at
/usr/local/apache/common-local/php-1.21wmf2/includes/actions/RawAction.php on
line 155
Server: srv213
Method: GET
URL:
http://commons.wikimedia.org/w/index.php?title=File:Ward_Cunningham_-_Commons-1.jpg&action=raw&ctype=text/css&oldid=69956248&maxage=0&smaxage=0
Backtrace:
#0
/usr/local/apache/common-local/php-1.21wmf2/includes/actions/RawAction.php(155):
RawAction::getRawText()
#1
/usr/local/apache/common-local/php-1.21wmf2/includes/actions/RawAction.php(99):
RawAction->getRawText()
#2 /usr/local/apache/common-local/php-1.21wmf2/includes/Action.php(541):
RawAction->onView()
#3 /usr/local/apache/common-local/php-1.21wmf2/includes/Wiki.php(428):
FormlessAction->show()
#4 /usr/local/apache/common-local/php-1.21wmf2/includes/Wiki.php(305):
MediaWiki->performAction(Object(ImagePage))
#5 /usr/local/apache/common-local/php-1.21wmf2/includes/Wiki.php(554):
MediaWiki->performRequest()
#6 /usr/local/apache/common-local/php-1.21wmf2/includes/Wiki.php(447):
MediaWiki->main()
#7 /usr/local/apache/common-local/php-1.21wmf2/index.php(59): MediaWiki->run()
#8 /usr/local/apache/common-local/live-1.5/index.php(3):
require('/usr/local/apac...')
#9 {main}

				if ( !$content instanceof TextContent ) {
					wfHttpError( 415, "Unsupported Media Type", "The requested page uses the content model `"
										. $content->getModel() . "` which is not supported via this interface." );
					die();
				}

We're already in an error block at this point.

revision->getContent() can return Content or null, but is only documented as returning Content.

I'm highly suspecting it's getting null.

Moved to ContentHandler

(In reply to comment #2)

revision->getContent() can return Content or null, but is only documented as
returning Content.

https://gerrit.wikimedia.org/r/28454 fixes up the docs

revision->getContent() can return null if a revision was deleted (or was lost). I'll look at it.

ctype=text/css? that request seems pretty broken...

Anyway. Fix submitted to git: Iac856075