Page MenuHomePhabricator

Call to undefined method Title::getType() in .../includes/job/JobQueueGroup.php
Closed, ResolvedPublic

Description

The recent refactoring broke some unit tests of Translate extension.

twn:/www/dev.translatewiki.net/w/extensions/Translate/tests (master)$ make
php ../../../tests/phpunit/phpunit.php .
PHPUnit 3.6.10 by Sebastian Bergmann.

Configuration read from /www/dev.translatewiki.net/w/tests/phpunit/suite.xml

............................................................... 63 / 140 ( 45%)
.
Fatal error: Call to undefined method Title::getType() in /www/dev.translatewiki.net/w/includes/job/JobQueueGroup.php on line 90
make: *** [default] Error 255

Marking as blocker because this affects Translate extension development because it is integrated to Jenkins in Gerrit. It also prevents us to update translatewiki.net production due to fear it will break badly.

JobQueueGroup.php line 86 calls wfBacktrace()
Job.php line 163 calls JobQueueGroup->push()
MessageGroupStatesUpdaterJob.php line 24 calls Job->insert()

  • line - calls MessageGroupStatesUpdaterJob::onChange()

Hooks.php line 253 calls call_user_func_array()
GlobalFunctions.php line 3811 calls Hooks::run()
TranslateEditAddons.php line 347 calls wfRunHooks()

  • line - calls TranslateEditAddons::onSave()

Hooks.php line 253 calls call_user_func_array()
GlobalFunctions.php line 3811 calls Hooks::run()
WikiPage.php line 1897 calls wfRunHooks()
WikiPage.php line 1569 calls WikiPage->doEditContent()
MessageGroupStatesUpdaterJobTest.php line 118 calls WikiPage->doEdit()

  • line - calls MessageGroupStatesUpdaterJobTest->testHooks()

TestCase.php line 942 calls ReflectionMethod->invokeArgs()
TestCase.php line 804 calls PHPUnit_Framework_TestCase->runTest()
TestResult.php line 649 calls PHPUnit_Framework_TestCase->runBare()
TestCase.php line 751 calls PHPUnit_Framework_TestResult->run()
MediaWikiTestCase.php line 87 calls PHPUnit_Framework_TestCase->run()
TestSuite.php line 772 calls MediaWikiTestCase->run()
TestSuite.php line 745 calls PHPUnit_Framework_TestSuite->runTest()
TestSuite.php line 705 calls PHPUnit_Framework_TestSuite->run()
TestRunner.php line 325 calls PHPUnit_Framework_TestSuite->run()
Command.php line 192 calls PHPUnit_TextUI_TestRunner->doRun()
MediaWikiPHPUnitCommand.php line 45 calls PHPUnit_TextUI_Command->run()
phpunit.php line 107 calls MediaWikiPHPUnitCommand::main()

Apparently it is trying to cast an object to array with catastrophic results.


Version: 1.21.x
Severity: blocker
URL: https://gerrit.wikimedia.org/r/#/c/13194/

Details

Reference
bz41098

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:53 AM
bzimport set Reference to bz41098.
bzimport added a subscriber: Unknown Object (MLST).

Appears to be related to gerrit 13194 which does not have any BC considerations. Schema change is *required* after this patch set, even though, IIRC, new features with schema changes should not break things in core (the recent ContentHandler merge also *required* a schema change).

Adding Aaron, Asher, Daniel, Terry and Tim in CC because of their involvement in gerrit 13194, and Rob Lanphier from a schema change policy perspective.

FYI: ContentHandler does not require a schema change, it has a compat mode (set $wgContentHandlerUseDB = false). This is what is being deployed on the WMF cluster. However, if you run update.php, it will change the schema (see bug 40854).

That backtrace seems useless, try running them with https://gerrit.wikimedia.org/r/#/c/28387/ to get a better one.

(In reply to comment #2)

FYI: ContentHandler does not require a schema change, it has a compat mode (set
$wgContentHandlerUseDB = false). This is what is being deployed on the WMF
cluster. However, if you run update.php, it will change the schema (see bug
40854).

Daniel, wgContentHandlerUseDB is set to false by default of course so that updaters don't immediately have a broken wiki, right?

(In reply to comment #3)

That backtrace seems useless, try running them with
https://gerrit.wikimedia.org/r/#/c/28387/ to get a better one.

The trace is the same code path according to nikerabbit. Chad and I were confused be this but it makes sense technically:
"If an object is converted to an array, the result is an array whose elements are the object's properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a '*' prepended to the variable name."

...thus it does NOT make an array with just that object (which PHP does do for primitives but not objects). This pattern is used in a lot of code so I well have to grep through it all to audit it later.

The fix for the job code is in https://gerrit.wikimedia.org/r/28450.

Merged. Also the other array type casting in includes/ looks OK.