Page MenuHomePhabricator

Fatal error: Call to a member function getOption() on a non-object in extensions/BetaFeatures/BetaFeaturesHooks.php on line 115
Closed, ResolvedPublic

Description

Just by installing the extension and not enabling any beta feature, AFAIK (long story: http://paste.debian.net/111811/ ).

$ php5 phpunit.php

[...]

PHPUnit 3.7.37 by Sebastian Bergmann.

Configuration read from /srv/vagrant/mediawiki/tests/phpunit/suite.xml

[...]

........................................................... 2183 / 14398 ( 15%)
.....................FPHP Fatal error: Call to a member function getOption() on a non-object in /srv/vagrant/mediawiki/extensions/BetaFeatures/BetaFeaturesHooks.php on line 115
PHP Stack trace:
PHP 1. {main}() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:0
PHP 2. MediaWikiPHPUnitCommand::main() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160
PHP 3. PHPUnit_TextUI_Command->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:350
PHP 6. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
PHP 7. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
PHP 8. PHPUnit_Framework_TestSuite->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:749
PHP 9. MediaWikiTestCase->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:779
PHP 10. PHPUnit_Framework_TestCase->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
PHP 11. PHPUnit_Framework_TestResult->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
PHP 12. PHPUnit_Framework_TestCase->runBare() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
PHP 13. PHPUnit_Framework_TestCase->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
PHP 14. ReflectionMethod->invokeArgs() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
PHP 15. UserTest->testEditCount() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
PHP 16. User->addToDatabase() /srv/vagrant/mediawiki/tests/phpunit/includes/UserTest.php:218
PHP 17. User->saveOptions() /srv/vagrant/mediawiki/includes/User.php:3615
PHP 18. wfRunHooks() /srv/vagrant/mediawiki/includes/User.php:4775
PHP 19. Hooks::run() /srv/vagrant/mediawiki/includes/GlobalFunctions.php:4031
PHP 20. call_user_func_array() /srv/vagrant/mediawiki/includes/Hooks.php:206
PHP 21. BetaFeaturesHooks::updateUserCounts() /srv/vagrant/mediawiki/includes/Hooks.php:206

Fatal error: Call to a member function getOption() on a non-object in /srv/vagrant/mediawiki/extensions/BetaFeatures/BetaFeaturesHooks.php on line 115

Call Stack:

  0.0005     252912   1. {main}() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:0
  2.4455   25291488   2. MediaWikiPHPUnitCommand::main() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160
  2.4456   25303960   3. PHPUnit_TextUI_Command->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
 44.9965  200894920   4. PHPUnit_TextUI_TestRunner->doRun() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
 45.0378  201215464   5. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:350
 45.7795  201217592   6. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
445.1807  348383968   7. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
445.6279  348769688   8. PHPUnit_Framework_TestSuite->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:749
445.6279  348769688   9. MediaWikiTestCase->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:779
445.6303  348769928  10. PHPUnit_Framework_TestCase->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
445.6303  348769928  11. PHPUnit_Framework_TestResult->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
445.6304  348770872  12. PHPUnit_Framework_TestCase->runBare() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
445.6311  348794224  13. PHPUnit_Framework_TestCase->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
445.6311  348794984  14. ReflectionMethod->invokeArgs() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
445.6311  348795240  15. UserTest->testEditCount() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
445.6315  348798392  16. User->addToDatabase() /srv/vagrant/mediawiki/tests/phpunit/includes/UserTest.php:218
445.6575  348798392  17. User->saveOptions() /srv/vagrant/mediawiki/includes/User.php:3615
445.6592  348835112  18. wfRunHooks() /srv/vagrant/mediawiki/includes/User.php:4775
445.6592  348835160  19. Hooks::run() /srv/vagrant/mediawiki/includes/GlobalFunctions.php:4031
445.6593  348836080  20. call_user_func_array() /srv/vagrant/mediawiki/includes/Hooks.php:206
445.6593  348836520  21. BetaFeaturesHooks::updateUserCounts() /srv/vagrant/mediawiki/includes/Hooks.php:206

Version: unspecified
Severity: normal

Details

Reference
bz68626

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:37 AM
bzimport added a project: BetaFeatures.
bzimport set Reference to bz68626.
Nemo_bis created this task.Jul 26 2014, 6:39 PM

Oh, I ran into that and investigated a bit before getting bored.

It's because a test is ran for a registered user with invalid username ("127.0.0.1", IIRC), and so BetaFeatures' hook that tries to recreate that user object blows up.

Why do we have a test that does such strange things, and where it is, is the point where I got bored and just disabled the extension before running tests.

Thanks MatmaRex.

  • Bug 68958 has been marked as a duplicate of this bug. ***
aude added a comment.Sep 18 2014, 2:15 PM

note, this happens w/o hhvm

Change 161670 had a related patch set uploaded by Aude:
Fix edit count UserTest which incorrectly adds user to db

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

Change 161670 merged by jenkins-bot:
UserTest: Fix edit count test which incorrectly added user to db

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