Last modified: 2014-07-07 19:16:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T69138, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67138 - BetaFeatures: AutoEnrollmentTest produce a fatal error with OATHAuth extension
BetaFeatures: AutoEnrollmentTest produce a fatal error with OATHAuth extension
Status: VERIFIED FIXED
Product: MediaWiki extensions
Classification: Unclassified
BetaFeatures (Other open bugs)
unspecified
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: 67216
  Show dependency treegraph
 
Reported: 2014-06-26 15:26 UTC by Antoine "hashar" Musso (WMF)
Modified: 2014-07-07 19:16 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Antoine "hashar" Musso (WMF) 2014-06-26 15:26:47 UTC
I have been running unit tests with master versions of core BetaFeatures and OATHAuth. I am given a fatal error:

$ /bin/ls -1 extensions
BetaFeatures
OATHAuth
$

$ php tests/phpunit/phpunit.php extensions/BetaFeatures
PHPUnit 3.7.30 by Sebastian Bergmann.

Configuration read from tests/phpunit/suite.xml

Fatal error: Call to a member function isEnabled() on a non-object in /extensions/OATHAuth/OATHAuth.hooks.php on line 126

Call Stack:
  1. {main}() /core/tests/phpunit/phpunit.php:0
  2. MediaWikiPHPUnitCommand::main() /core/tests/phpunit/phpunit.php:160
  3. PHPUnit_TextUI_Command->run() /core/tests/phpunit/MediaWikiPHPUnitCommand.php:42
  4. PHPUnit_TextUI_TestRunner->doRun() /pear/PHPUnit/TextUI/Command.php:176
  5. PHPUnit_Framework_TestSuite->run() /pear/PHPUnit/TextUI/TestRunner.php:349
  6. PHPUnit_Framework_TestSuite->run() /pear/PHPUnit/Framework/TestSuite.php:705
  7. PHPUnit_Framework_TestSuite->run() /pear/PHPUnit/Framework/TestSuite.php:705
  8. PHPUnit_Framework_TestSuite->runTest() /pear/PHPUnit/Framework/TestSuite.php:745
  9. MediaWikiTestCase->run() /pear/PHPUnit/Framework/TestSuite.php:775
  10. PHPUnit_Framework_TestCase->run() /core/tests/phpunit/MediaWikiTestCase.php:133
  11. PHPUnit_Framework_TestResult->run() /pear/PHPUnit/Framework/TestCase.php:783
  12. PHPUnit_Framework_TestCase->runBare() /pear/PHPUnit/Framework/TestResult.php:648
  13. PHPUnit_Framework_TestCase->runTest() /pear/PHPUnit/Framework/TestCase.php:838
  14. ReflectionMethod->invokeArgs() /pear/PHPUnit/Framework/TestCase.php:983
  15. AutoEnrollmentTest->testAutoEnroll() /pear/PHPUnit/Framework/TestCase.php:983
  16. wfRunHooks() /extensions/BetaFeatures/tests/AutoEnrollmentTest.php:146
  17. Hooks::run() /core/includes/GlobalFunctions.php:4056
  18. call_user_func_array:{/core/includes/Hooks.php:206}() /core/includes/Hooks.php:206
  19. OATHAuthHooks::manageOATH() /core/includes/Hooks.php:206

---------

OATHAuthHooks::manageOATH() calls OATHUser::newFromUser() which returns NULL when $user->getID() is 0.

Thus:

  if ( $oathUser->isEnabled() )

produces a fatal.

I have made two tiny useless patches, but would appreciate someone that knows PHP to look at it :)
Comment 1 Gerrit Notification Bot 2014-06-26 15:27:37 UTC
Change 142252 had a related patch set uploaded by Hashar:
Only manage logged users

https://gerrit.wikimedia.org/r/142252
Comment 2 Gerrit Notification Bot 2014-06-26 15:27:52 UTC
Change 142251 had a related patch set uploaded by Hashar:
Run test with a logged in user

https://gerrit.wikimedia.org/r/142251
Comment 3 Antoine "hashar" Musso (WMF) 2014-06-30 14:08:37 UTC
We really need tests to pass when all wmf extensions are installed together. That is preventing us from progression toward the HHVM migrating. Raising priority to High.
Comment 4 Antoine "hashar" Musso (WMF) 2014-06-30 15:44:59 UTC
A similar issue happens with the OpenStackManager. Both extensions are registered the GetPreferences hook.
Comment 5 Gerrit Notification Bot 2014-06-30 15:51:29 UTC
Change 143042 had a related patch set uploaded by Hashar:
Avoid extensions conflicts by hook GetPreferences

https://gerrit.wikimedia.org/r/143042
Comment 6 James Forrester 2014-06-30 16:00:43 UTC
This is a false positive issue, because OATHAuth and BetaFeatures aren't enabled on the same wikis, but let's get this fixed.
Comment 7 Antoine "hashar" Musso (WMF) 2014-06-30 16:05:29 UTC
I talked with James about comment #6. The idea is to run tests with all wmf extensions installed regardless of configuration settings made in mediawiki-config.

The patch https://gerrit.wikimedia.org/r/143042 fix my test case (stock wiki with extensions BetaFeatures OATHAuth and OpenStackManager).  Was due to GetPreference hooks being invoked while extensions are not properly configured.
Comment 8 Gerrit Notification Bot 2014-06-30 16:25:14 UTC
Change 142252 abandoned by Hashar:
Only manage logged users

Reason:
I got BetaFeatures tests fixed with https://gerrit.wikimedia.org/r/#/c/143042/ . So this lame change is probably no more needed.
Free free to reopen.

https://gerrit.wikimedia.org/r/142252
Comment 9 Gerrit Notification Bot 2014-07-01 18:27:14 UTC
Change 143042 merged by jenkins-bot:
Avoid extensions conflicts by hook GetPreferences

https://gerrit.wikimedia.org/r/143042
Comment 10 James Forrester 2014-07-01 19:48:56 UTC
Fixed, maybe?
Comment 11 Antoine "hashar" Musso (WMF) 2014-07-02 08:49:01 UTC
Works for me locally.

amusso@aeriale:/srv/trunk(masteru=)$ /bin/ls extensions/
APC		BetaFeatures	OATHAuth	README		link_ext.sh	wmfexts
amusso@aeriale:/srv/trunk(masteru=)$ php tests/phpunit/phpunit.php extensions/BetaFeatures
PHPUnit 3.7.30 by Sebastian Bergmann.

Configuration read from /Users/amusso/projects/mediawiki/core/tests/phpunit/suite.xml

.........................

Time: 650 ms, Memory: 22.50Mb

OK (25 tests, 38 assertions)
amusso@aeriale:/srv/trunk(masteru=)$ 



The fatal is gone from the Jenkins job that runs tests of all extensions together https://integration.wikimedia.org/ci/job/mediawiki-core-extensions-integration/59/console


Thank you!
Comment 12 Gerrit Notification Bot 2014-07-02 10:13:51 UTC
Change 142251 abandoned by Hashar:
Run test with a logged in user

Reason:
No more needed AFAIK :-D

https://gerrit.wikimedia.org/r/142251
Comment 13 Antoine "hashar" Musso (WMF) 2014-07-07 19:16:55 UTC
My super Jenkins job is no more impacted. Well done. https://integration.wikimedia.org/ci/job/mediawiki-core-extensions-integration/68/testReport/

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links