Page MenuHomePhabricator

PHP Catchable fatal error: Argument 1 passed to ContentHandler::getContentText() must implement interface Content, boolean given ContentHandler line 95 - on certain extension(s)
Closed, ResolvedPublic

Description

PHP Catchable fatal error: Argument 1 passed to ContentHandler::getContentText() must implement interface Content, boolean given, called in /srv/www-ssl/htdocs/phase3/includes/Article.php on line 390 and defined in /srv/www-ssl/htdocs/phase3/includes/content/ContentHandler.php on line 95

Version


Version: master
Severity: normal

Details

Reference
bz43737

Event Timeline

bzimport raised the priority of this task from to High.
bzimport set Reference to bz43737.
Wikinaut created this task.Jan 8 2013, 2:49 PM
MaxSem added a comment.Jan 8 2013, 2:51 PM

Call stack? Installed extensions?

Max, good point. I made a bisect and found that (unluckily, my current work target) extension:RSS causes this.

I pulled the 00691 version today in order to upgrade my wikis.

Any idea what can be the reason, why E:RSS causes this error ?
I will downgrade the importance, because it's not a mere core issue, apparently.

hoo added a comment.Jan 8 2013, 3:01 PM

Please set $wgShowExceptionDetails = true; in your LocalSettings and post the call stack here ;)

did so. But no output at all (white screen).

I will start again - with a fresh chechkout.

debug log file says

  • Article::fetchContentObject failed to find page data for title MediaWiki:Rss-item

Even when Article:fetchContentObject fails, it should - in my view - never cause a fatal PHP error.

RSS.i18n.php initializes the message correctly to

  • 'rss-item' => '{{$1 | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} | description = {{{description}}} }}'

After pulling the new core version, I did "php update.php". Should I run further maintenance scripts ?

I now successfully run all - except wikis - with unchanged E:RSS. Except the one wiki with verion 00691, but ...

... the Main_page of that wiki does not work with E:RSS, however, _other_ pages of that wiki do work as they should.

Can the reason be a database table problem ?

What do you suggest me to do ?

I could isolate the bug, it's due to a problem with the templates used in the extension RSS

perhaps the sandbox parsing in wrong context

jrsusenet-bugzilla1401 wrote:

I am getting nearly the same error:

Argument 1 passed to ContentHandler::getContentText() must implement interface Content, boolean given, called in /var/www/html/wiki/includes/Article.php on line 389 and defined in /var/www/html/wiki/includes/content/ContentHandler.php on line 95

Although I activated stack trace, I got no additional output.

System Linux 2.6.18-348.18.1.el5 #1 SMP Thu Sep 26 15:05:49 EDT 2013 i686

Apache Version Apache/2.2.3 (CentOS)
PHP Version 5.3.3

Error message comes up in left navigation bar in "tools" box just below "Page Information" item.

Installed extensions in extension directory:

drwxr-xr-x 3 997 1004 4096 Dec 6 23:14 Cite
drwxr-xr-x 4 997 1004 4096 Dec 6 23:13 ConfirmEdit
drwxr-xr-x 3 997 1004 4096 Dec 6 23:14 Gadgets
drwxr-xr-x 2 997 1004 4096 Dec 6 23:14 ImageMap
drwxr-xr-x 2 997 1004 4096 Dec 6 23:14 InputBox
drwxr-xr-x 2 997 1004 4096 Dec 6 23:14 Interwiki
drwxr-xr-x 3 997 1004 4096 Dec 6 23:14 LocalisationUpdate
drwxr-xr-x 3 wiki wiki 4096 Sep 9 10:52 MultiUpload
drwxr-xr-x 2 997 1004 4096 Dec 6 23:13 Nuke
drwxr-xr-x 3 997 1004 4096 Dec 6 23:14 ParserFunctions
drwxr-xr-x 2 997 1004 4096 Dec 6 23:13 PdfHandler
drwxr-xr-x 2 997 1004 4096 Dec 6 23:13 Poem
-rw-rw-r-- 1 997 1004 1106 Dec 6 23:13 README
drwxr-xr-x 3 997 1004 4096 Dec 6 23:14 Renameuser
drwxr-xr-x 2 997 1004 4096 Dec 6 23:13 SimpleAntiSpam
drwxr-xr-x 2 997 1004 4096 Dec 6 23:14 SpamBlacklist
drwxr-xr-x 3 997 1004 4096 Dec 6 23:13 SyntaxHighlight_GeSHi
drwxr-xr-x 5 997 1004 4096 Dec 6 23:14 TitleBlacklist
drwxr-xr-x 3 wiki wiki 4096 Aug 31 23:35 TreeAndMenu
drwxr-xr-x 3 wiki wiki 4096 Sep 3 20:56 Vector
drwxr-xr-x 4 997 1004 4096 Dec 6 23:14 WikiEditor

This bug appears to be (now?) affecting mediawiki.org as https://www.mediawiki.org/wiki/MediaWiki/Homepage_redesign/Preview returns:


PHP fatal error in /usr/local/apache/common-local/php-1.24wmf2/includes/content/ContentHandler.php line 94:

Argument 1 passed to ContentHandler::getContentText() must implement interface Content, boolean given, called in /usr/local/apache/common-local/php-1.24wmf2/includes/Article.php on line 390 and defined

Eep!

This issue may be related to the RSS MediaWiki extension, though comment 10 suggests otherwise.

Change 130835 had a related patch set uploaded by Anomie:
Avoid fatal in Article::fetchContent()

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

Anomie added a comment.May 1 2014, 2:18 PM

So the root cause of the bug is that Article::fetchContent() doesn't bother to check whether it actually got a Content object before trying to use it. The error on https://www.mediawiki.org/wiki/MediaWiki/Homepage_redesign/Preview is coming via the RSS extension, while the error in comment 10 is presumably some other extension calling that same method.

Note that Article::fetchContent() is deprecated and extensions should be adjusted to not use it anymore, but in the mean time there's no excuse for it fataling for something as simple as being asked for the content of a nonexistent page.

Change 130837 had a related patch set uploaded by Aude:
Check if template title exists, if not fallback to Rss-feed

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

Change 130835 merged by jenkins-bot:
Avoid fatal in Article::fetchContent()

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

Change 130838 had a related patch set uploaded by Anomie:
Avoid fatal in Article::fetchContent()

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

Change 130838 merged by jenkins-bot:
Avoid fatal in Article::fetchContent()

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

@Brad, is this fixed now ?