Page MenuHomePhabricator

Catchable fatal error: Argument 2 passed to Parser::parse() must be an instance of Title, null given, called in /www/dev.translatewiki.net/w/includes/OutputPage.php on line 1484
Closed, DeclinedPublic

Description

make safe
php phpunit.php --configuration /www/dev.translatewiki.net/w/tests/phpunit/suite.xml --exclude-group Broken,ParserFuzz,Destructive,Stub
PHPUnit 3.7.8 by Sebastian Bergmann.

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

E.................SSSSS.....F
Fatal error: Cannot redeclare class SiteStats in /www/dev.translatewiki.net/w/includes/SiteStats.php on line 26
make: *** [safe] Error 255


Version: master
Severity: critical

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 1:07 AM
bzimport set Reference to bz42145.
bzimport added a subscriber: Unknown Object (MLST).
  • There is only one match for declaration of class SiteStats in mediawiki/core (namely includes/SiteStats.php)
  • The file is in AutoLoader
  • The file is not manually included from anywhere else

So I can only guess this is a fault in an extension or local settings?

Maybe it was APC. Now the error is different:

twn:/www/dev.translatewiki.net/w/tests/phpunit (master)$ make safe
php phpunit.php --configuration /www/dev.translatewiki.net/w/tests/phpunit/suite.xml --exclude-group Broken,ParserFuzz,Destructive,Stub
PHPUnit 3.7.8 by Sebastian Bergmann.

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

..................SSSSS.....FFFFF.
Catchable fatal error: Argument 2 passed to Parser::parse() must be an instance of Title, null given, called in /www/dev.translatewiki.net/w/includes/OutputPage.php on line 1484 and defined in /www/dev.translatewiki.net/w/includes/parser/Parser.php on line 346
make: *** [safe] Error 255

Git bisect gives I8f23c6535f7b3ee6462d9c5a19dd06070e77f9d1 as the cause.

I8f23c6535 Introduces new tests for EditPage. It does not touch existing code. I have no idea how that could cause this bug.

Can you possibly catch the error and give out a full stack trace?

Also it would be helpful to get the name of test failing. Either look it up in the debug log or catch the error and dump a stack trace.

/www/dev.translatewiki.net/w/includes/OutputPage.php:1475
/www/dev.translatewiki.net/w/includes/OutputPage.php:1426
/www/dev.translatewiki.net/w/extensions/ConfirmEdit/Captcha.php:59
/www/dev.translatewiki.net/w/includes/EditPage.php:2049
/www/dev.translatewiki.net/w/extensions/ConfirmEdit/Captcha.php:472
/www/dev.translatewiki.net/w/extensions/ConfirmEdit/Captcha.php:485
/www/dev.translatewiki.net/w/extensions/ConfirmEdit/ConfirmEditHooks.php:23
/www/dev.translatewiki.net/w/includes/Hooks.php:253
/www/dev.translatewiki.net/w/includes/GlobalFunctions.php:3815
/www/dev.translatewiki.net/w/includes/EditPage.php:1389
/www/dev.translatewiki.net/w/tests/phpunit/includes/EditPageTest.php:151
/www/dev.translatewiki.net/w/tests/phpunit/includes/EditPageTest.php:393
/www/dev.translatewiki.net/w/tests/phpunit/MediaWikiTestCase.php:87
/www/dev.translatewiki.net/w/tests/phpunit/MediaWikiPHPUnitCommand.php:45

Was a bit tricky to catch because of bug 41491.

So... the edit page test fails if it triggers a captcha?

Looks like it.

Since that seems to be caused by ConfirmEdit extension, I am changing the component.

Given it was introduced in https://gerrit.wikimedia.org/r/#/c/29973/ I was hoping we could find fixers from there. In any case this bug should be assigned to someone asap.

sumanah wrote:

leucosticte and Martineznovo, could you take a look at this?

Sorry Sumana but I know nothing about this, I can't help :(

[removing myself from cc]

Setting $wgTitle in EditPageTest::assertEdit works, but sounds not like a real solution

You need one of:

$wgCaptchaTriggers['edit'] = true;
$wgCaptchaTriggers['create'] = true;

to trigger the error (now the exception)

(In reply to db from comment #13)

Setting $wgTitle in EditPageTest::assertEdit works, but sounds not like a
real solution

You need one of:

$wgCaptchaTriggers['edit'] = true;
$wgCaptchaTriggers['create'] = true;

So we should just set $wgCaptchaTriggers false in EditPageTest::assertEdit, as that's what the test currently assumes. Right?

Krinkle set Security to None.
Krinkle removed subscribers: Unknown Object (MLST), Krinkle.
Florian claimed this task.Jan 2 2015, 9:24 PM

I can't reproduce the Exception anymore, but there is in general no need to run tests with enabled ConfirmEdit in any way, tests don't cover such extensions :)

Change 182480 had a related patch set uploaded (by Florianschmidtwelzow):
Disable Captchas in phpunit

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

Patch-For-Review

hashar added a subscriber: hashar.EditedFeb 10 2015, 10:09 AM

The $wgWikimediaJenkinsCI variable is really a hack. I have filled T89096 to get a better system.

I am going to merge @Florian patch though: we can clear up that variable usage from ConfirmEdit later on.

Change 182480 merged by jenkins-bot:
Disable Captchas in phpunit

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

Florian removed Florian as the assignee of this task.Jun 12 2015, 3:54 PM

Placing this up for grabs now. It's fixed, but i think we should still wait and try to kill this solution asap :)

Florian lowered the priority of this task from High to Low.Jan 21 2016, 5:26 PM

Setting a new priority, it should be fixed with the merged change (see above comment from @gerritbot) and now we can wait for the "blocked by" task, only.

I seriously doubt that the reporter was using $wgWikimediaJenkinsCI and it's not nice to break unit tests in the developers' environment.

My proposal seems the only one so far...

So we should just set $wgCaptchaTriggers false in EditPageTest::assertEdit, as that's what the test currently assumes. Right?

We could also do that in the setUp() function, CAPTCHAs aren't needed in any test case, even if assertEdit isn't called, right?

I don't know... a test case to verify that action=edit loads and contains certain basic elements can be still relevant.

I don't know... a test case to verify that action=edit loads and contains certain basic elements can be still relevant.

That's not an unit test. Browser tests use different software.

Krinkle closed this task as Declined.Oct 27 2018, 6:58 PM