Page MenuHomePhabricator

Under HHVM: Fatal error: Argument 1 passed to AbstractContent::getParserOutput() must be an instance of Title, null given
Closed, ResolvedPublic

Description

Caller appears to be SpamBlacklistHooks::filterMergedContent()

To reproduce, run the extension's unit tests under HHVM.

Error and trace info:

Fatal error: Argument 1 passed to AbstractContent::getParserOutput() must be an instance of Title, null given in /srv/mediawiki/includes/content/AbstractContent.php on line 490

#0 at [/srv/mediawiki/includes/content/AbstractContent.php:490]\n    #1 AbstractContent->getParserOutput(), called at [/srv/mediawiki/extensions/SpamBlacklist/SpamBlacklistHooks.php:28]\n    #2 SpamBlacklistHooks::filterMergedContent(), called at [/srv/mediawiki/includes/Hooks.php:206]\n    #3 Hooks::run(), called at [/srv/mediawiki/includes/GlobalFunctions.php:4056]\n    #4 wfRunHooks(), called at [/srv/mediawiki/includes/EditPage.php:1506]\n    #5 EditPage->runPostMergeFilters(), called at [/srv/mediawiki/includes/EditPage.php:1755]\n    #6 EditPage->internalAttemptSave(), called at [/srv/mediawiki/tests/phpunit/includes/EditPageTest.php:153]\n    #7 EditPageTest->assertEdit(), called at [/srv/mediawiki/tests/phpunit/includes/EditPageTest.php:192]\n    #8 EditPageTest->testCreatePage(), called at [:0]\n    #9 ReflectionMethod->invokeArgs(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestCase.php:951]\n    #10 PHPUnit_Framework_TestCase->runTest(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestCase.php:817]\n    #11 PHPUnit_Framework_TestCase->runBare(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestResult.php:686]\n    #12 PHPUnit_Framework_TestResult->run(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestCase.php:753]\n    #13 PHPUnit_Framework_TestCase->run(), called at [/srv/mediawiki/tests/phpunit/MediaWikiTestCase.php:133]\n    #14 MediaWikiTestCase->run(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:675]\n    #15 PHPUnit_Framework_TestSuite->run(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:675]\n    #16 PHPUnit_Framework_TestSuite->run(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/Framework/TestSuite.php:675]\n    #17 PHPUnit_Framework_TestSuite->run(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:426]\n    #18 PHPUnit_TextUI_TestRunner->doRun(), called at [/srv/mediawiki/vendor/phpunit/phpunit/src/TextUI/Command.php:179]\n    #19 PHPUnit_TextUI_Command->run(), called at [/srv/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42]\n    #20 MediaWikiPHPUnitCommand::main(), called at [/srv/mediawiki/tests/phpunit/phpunit.php:160]

Version: master
Severity: normal

Details

Reference
bz66930

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:29 AM
bzimport added a project: SpamBlacklist.
bzimport set Reference to bz66930.

I see two bugs here. One, we should figure out why we're passing null here and see if that's a bug. It might not be.

HHVM I think is being a little overzealous here though. Isn't null an acceptable value for a typed parameter?

(In reply to Chad H. from comment #1)

HHVM I think is being a little overzealous here though. Isn't null an
acceptable value for a typed parameter?

It could very well be an HHVM bug. If you can produce a minimal case that generates a different result on HHVM and Zend PHP it'd be very helpful.

(In reply to Chad H. from comment #1)

HHVM I think is being a little overzealous here though. Isn't null an
acceptable value for a typed parameter?

$ php eval.php

function f(stdClass $x) { echo get_class($x); }

f(new stdClass);

stdClass

f(null)

PHP Catchable fatal error: Argument 1 passed to f() must be an instance of stdClass, null given, called in /vagrant/mediawiki/maintenance/eval.php(81) : eval()'d code on line 1 and defined in /vagrant/mediawiki/maintenance/eval.php(81) : eval()'d code on line 1

$ hhvm -a
hphpd> function f(stdClass $x) { echo get_class($x); }
hphpd> f(new stdClass);
stdClass
hphpd> f(null);
Notice: Attempted to interpret unknown debugger command as PHP!

Hit fatal : Argument 1 passed to f() must be an instance of stdClass, null given

#0 at [:1]
#1 f(), called at [:1]
#2 include(), called at [:1]

Change 141483 had a related patch set uploaded by Ori.livneh:
Use preg_match rather than fnmatch for 'like' operator

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

Change 141483 merged by jenkins-bot:
Use preg_match rather than fnmatch for 'like' operator

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

Sorry, the patch is unrelated to this bug; I meant to reference bug 66935 instead.

Change 147334 had a related patch set uploaded by MaxSem:
Editing unit tests: set title in context

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

Change 147334 merged by jenkins-bot:
Editing unit tests: set title in context

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