Page MenuHomePhabricator

PHP Notice: Undefined index: REQUEST_TIME in extensions/EventLogging/includes/EventLogging.php on line 56
Closed, InvalidPublic

Description

php5 phpunit.php

When doing http://paste.debian.net/111811/ , phpunit incurs in this:

PHP Notice: Undefined index: REQUEST_TIME in /srv/vagrant/mediawiki/extensions/EventLogging/includes/EventLogging.php on line 56
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->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
PHP 9. PHPUnit_Framework_TestSuite->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:749
PHP 10. MediaWikiTestCase->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:779
PHP 11. PHPUnit_Framework_TestCase->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
PHP 12. PHPUnit_Framework_TestResult->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
PHP 13. PHPUnit_Framework_TestCase->runBare() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
PHP 14. PHPUnit_Framework_TestCase->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
PHP 15. ReflectionMethod->invokeArgs() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
PHP 16. SpecialNewPagesFeedTest->testAddArticles() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
PHP 17. ApiTestCase->doApiRequestWithToken() /srv/vagrant/mediawiki/extensions/PageTriage/tests/phpunit/SpecialNewPagesFeedTest.php:100
PHP 18. ApiTestCase->doApiRequest() /srv/vagrant/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:142
PHP 19. ApiMain->execute() /srv/vagrant/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:99
PHP 20. ApiMain->executeAction() /srv/vagrant/mediawiki/includes/api/ApiMain.php:332
PHP 21. ApiEditPage->execute() /srv/vagrant/mediawiki/includes/api/ApiMain.php:907
PHP 22. EditPage->internalAttemptSave() /srv/vagrant/mediawiki/includes/api/ApiEditPage.php:401
PHP 23. Article->doEditContent() /srv/vagrant/mediawiki/includes/EditPage.php:1973
PHP 24. Article->__call() /srv/vagrant/mediawiki/includes/EditPage.php:1973
PHP 25. call_user_func_array() /srv/vagrant/mediawiki/includes/page/Article.php:1992
PHP 26. WikiPage->doEditContent() /srv/vagrant/mediawiki/includes/page/Article.php:1992
PHP 27. wfRunHooks() /srv/vagrant/mediawiki/includes/page/WikiPage.php:2032
PHP 28. Hooks::run() /srv/vagrant/mediawiki/includes/GlobalFunctions.php:4031
PHP 29. call_user_func_array() /srv/vagrant/mediawiki/includes/Hooks.php:206
PHP 30. WikimediaEventsHooks::onPageContentInsertComplete() /srv/vagrant/mediawiki/includes/Hooks.php:206
PHP 31. WikimediaEventsHooks::logPageCreation() /srv/vagrant/mediawiki/extensions/WikimediaEvents/WikimediaEventsHooks.php:254
PHP 32. EventLogging::logEvent() /srv/vagrant/mediawiki/extensions/WikimediaEvents/WikimediaEventsHooks.php:196

Notice: Undefined index: REQUEST_TIME in /srv/vagrant/mediawiki/extensions/EventLogging/includes/EventLogging.php on line 56

Call Stack:

 0.0005     252912   1. {main}() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:0
 3.1858   25034984   2. MediaWikiPHPUnitCommand::main() /srv/vagrant/mediawiki/tests/phpunit/phpunit.php:160
 3.1859   25047464   3. PHPUnit_TextUI_Command->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiPHPUnitCommand.php:42
43.5670  196201632   4. PHPUnit_TextUI_TestRunner->doRun() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/Command.php:176
43.6076  196524896   5. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/TextUI/TestRunner.php:350

2979.9686 1021381672 6. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
2979.9689 1021383176 7. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
3006.5969 1036522696 8. PHPUnit_Framework_TestSuite->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:709
3007.1232 1037095048 9. PHPUnit_Framework_TestSuite->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:749
3007.1232 1037095048 10. MediaWikiTestCase->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestSuite.php:779
3007.1233 1037095208 11. PHPUnit_Framework_TestCase->run() /srv/vagrant/mediawiki/tests/phpunit/MediaWikiTestCase.php:133
3007.2455 1037095568 12. PHPUnit_Framework_TestResult->run() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:783
3007.2457 1037096512 13. PHPUnit_Framework_TestCase->runBare() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestResult.php:648
3007.6986 1037467560 14. PHPUnit_Framework_TestCase->runTest() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:838
3007.6987 1037468504 15. ReflectionMethod->invokeArgs() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
3007.6987 1037468776 16. SpecialNewPagesFeedTest->testAddArticles() /srv/vagrant/mediawiki/vendor/phpunit/phpunit/PHPUnit/Framework/TestCase.php:988
3007.6987 1037469976 17. ApiTestCase->doApiRequestWithToken() /srv/vagrant/mediawiki/extensions/PageTriage/tests/phpunit/SpecialNewPagesFeedTest.php:100
3007.6987 1037471616 18. ApiTestCase->doApiRequest() /srv/vagrant/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:142
3007.6992 1037528872 19. ApiMain->execute() /srv/vagrant/mediawiki/tests/phpunit/includes/api/ApiTestCase.php:99
3007.6992 1037528920 20. ApiMain->executeAction() /srv/vagrant/mediawiki/includes/api/ApiMain.php:332
3007.7069 1037555016 21. ApiEditPage->execute() /srv/vagrant/mediawiki/includes/api/ApiMain.php:907
3008.1653 1037899936 22. EditPage->internalAttemptSave() /srv/vagrant/mediawiki/includes/api/ApiEditPage.php:401
3008.2155 1037909472 23. Article->doEditContent() /srv/vagrant/mediawiki/includes/EditPage.php:1973
3008.2155 1037910264 24. Article->__call() /srv/vagrant/mediawiki/includes/EditPage.php:1973
3008.2155 1037910704 25. call_user_func_array() /srv/vagrant/mediawiki/includes/page/Article.php:1992
3008.2155 1037911512 26. WikiPage->doEditContent() /srv/vagrant/mediawiki/includes/page/Article.php:1992
3008.3812 1037999520 27. wfRunHooks() /srv/vagrant/mediawiki/includes/page/WikiPage.php:2032
3008.3812 1037999568 28. Hooks::run() /srv/vagrant/mediawiki/includes/GlobalFunctions.php:4031
3008.3813 1038001544 29. call_user_func_array() /srv/vagrant/mediawiki/includes/Hooks.php:206
3008.3813 1038002848 30. WikimediaEventsHooks::onPageContentInsertComplete() /srv/vagrant/mediawiki/includes/Hooks.php:206
3008.3813 1038002848 31. WikimediaEventsHooks::logPageCreation() /srv/vagrant/mediawiki/extensions/WikimediaEvents/WikimediaEventsHooks.php:254
3008.3813 1038003736 32. EventLogging::logEvent() /srv/vagrant/mediawiki/extensions/WikimediaEvents/WikimediaEventsHooks.php:196


Version: unspecified
Severity: normal

Attached:

Details

Reference
bz68629

Event Timeline

bzimport raised the priority of this task from to Needs Triage.
bzimport set Reference to bz68629.
bzimport added a subscriber: Unknown Object (MLST).
Nemo_bis created this task.Jul 26 2014, 9:26 PM
hashar added a subscriber: hashar.Jan 16 2015, 11:30 AM

Seems EventLogging works fine under HHVM with a bunch of other extensions. Proposed https://gerrit.wikimedia.org/r/#/c/185405/ passed and ran with:

mediawiki/extensions/AbuseFilter
mediawiki/extensions/CheckUser
mediawiki/extensions/ConfirmEdit
mediawiki/extensions/Echo
mediawiki/extensions/EventLogging
mediawiki/extensions/JsonConfig
mediawiki/extensions/Mantle
mediawiki/extensions/MobileApp
mediawiki/extensions/MobileFrontend
mediawiki/extensions/SpamBlacklist
mediawiki/extensions/Thanks
mediawiki/extensions/VisualEditor
mediawiki/extensions/WikiGrok
mediawiki/extensions/ZeroBanner
mediawiki/extensions/ZeroPortal

Can you still reproduce?

Your definition of "a bunch" differs of 1-2 orders of magnitude from mine. :) I still have open patches to fix the bugs I found in the last phpunit run; until those are merged in gerrit, I won't try again.

QChris removed a subscriber: QChris.Apr 16 2015, 10:52 PM
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 10 2015, 11:01 PM
Krinkle closed this task as Invalid.Oct 5 2016, 10:21 PM
Krinkle added a subscriber: Krinkle.

The REQUEST_TIME code that assumed HTTP context and was problematic when called from the command-line (e.g. in PHPUnit) was removed in rEEVLc12e93f9e1f5: Submit server-side events via HTTP POST to the beacon endpoint.

@@ -53,22 +60,17 @@ static function logEvent( $schemaName, $revId, $event, $options = 0 ) {
-			'timestamp'        => $_SERVER[ 'REQUEST_TIME' ],