Page MenuHomePhabricator

FlaggedRevs: PHP Notice: Undefined variable: fname
Closed, ResolvedPublic

Description

Error message
[XXj@vgpAADwAAJF8f3sAAAAK] /wiki/Especial:Estat%C3%ADsticas_de_valida%C3%A7%C3%A3o
 ErrorException from line 346 of /srv/mediawiki/php-1.34.0-wmf.22/extensions/FlaggedRevs/frontend/specialpages/reports/ValidationStatistics.php:
PHP Notice: Undefined variable: fname
Impact

Only one occurrence

Notes

Code:

1.34.0-wmf.22/extensions/FlaggedRevs/frontend/specialpages/reports/ValidationStatistics.php
314     protected function getTopReviewers() {
315         $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
316         $fname = __METHOD__;
317 
318         return $cache->getWithSetCallback(
319             $cache->makeKey( 'flaggedrevs', 'reviewTopUsers' ),
320             $cache::TTL_HOUR,
321             function () {
322                 global $wgFlaggedRevsStats;
323 
324                 $dbr = wfGetDB( DB_REPLICA, 'vslow' );
325 
326                 $limit = (int)$wgFlaggedRevsStats['topReviewersCount'];
327                 $seconds = 3600 * $wgFlaggedRevsStats['topReviewersHours'];
328                 $cutoff = $dbr->timestamp( time() - $seconds );
329                 $actorQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
330                 $res = $dbr->select(
331                     [ 'logging' ] + $actorQuery['tables'],
332                     [ 'user' => $actorQuery['fields']['log_user'], 'COUNT(*) AS reviews' ],
333                     [
334                         'log_type' => 'review', // page reviews
335                         // manual approvals (filter on log_action)
336                         'log_action' => [ 'approve', 'approve2', 'approve-i', 'approve2-i' ],
337                         'log_timestamp >= ' . $dbr->addQuotes( $cutoff ) // last hour
338                     ],
339                     $fname,
340                     [
341                         'GROUP BY' => $actorQuery['fields']['log_user'],
342                         'ORDER BY' => 'reviews DESC',
343                         'LIMIT' => $limit
344                     ],
345                     $actorQuery['joins']
346                 );
347

Details

Request ID
XXj@vgpAADwAAJF8f3sAAAAK
Request URL
https://pt.wikisource.org/wiki/Especial:Estat%C3%ADsticas_de_valida%C3%A7%C3%A3o
Stack Trace
#0 /srv/mediawiki/php-1.34.0-wmf.22/extensions/FlaggedRevs/frontend/specialpages/reports/ValidationStatistics.php(346): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.34.0-wmf.22/includes/libs/objectcache/wancache/WANObjectCache.php(1425): Closure$ValidationStatistics::getTopReviewers(boolean, integer, array, NULL)
#2 /srv/mediawiki/php-1.34.0-wmf.22/includes/libs/objectcache/wancache/WANObjectCache.php(1278): WANObjectCache->fetchOrRegenerate(string, integer, Closure$ValidationStatistics::getTopReviewers;5038, array)
#3 /srv/mediawiki/php-1.34.0-wmf.22/extensions/FlaggedRevs/frontend/specialpages/reports/ValidationStatistics.php(359): WANObjectCache->getWithSetCallback(string, integer, Closure$ValidationStatistics::getTopReviewers;5038, array)
#4 /srv/mediawiki/php-1.34.0-wmf.22/extensions/FlaggedRevs/frontend/specialpages/reports/ValidationStatistics.php(180): ValidationStatistics->getTopReviewers()
#5 /srv/mediawiki/php-1.34.0-wmf.22/includes/specialpage/SpecialPage.php(573): ValidationStatistics->execute(NULL)
#6 /srv/mediawiki/php-1.34.0-wmf.22/includes/specialpage/SpecialPageFactory.php(601): SpecialPage->run(NULL)
#7 /srv/mediawiki/php-1.34.0-wmf.22/includes/MediaWiki.php(296): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#8 /srv/mediawiki/php-1.34.0-wmf.22/includes/MediaWiki.php(892): MediaWiki->performRequest()
#9 /srv/mediawiki/php-1.34.0-wmf.22/includes/MediaWiki.php(523): MediaWiki->main()
#10 /srv/mediawiki/php-1.34.0-wmf.22/index.php(44): MediaWiki->run()
#11 /srv/mediawiki/w/index.php(3): include(string)
#12 {main}
Related Gerrit Patches:
mediawiki/extensions/FlaggedRevs : wmf/1.34.0-wmf.22Add missing "use" to getTopReviewers()
mediawiki/extensions/FlaggedRevs : masterAdd missing "use" to getTopReviewers()

Event Timeline

hashar created this task.Sep 11 2019, 2:10 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 11 2019, 2:10 PM
hashar added a subscriber: aaron.Sep 11 2019, 2:16 PM

So the getTopReviewers last change was in 6a0ea2f677378b33cab83eabdb4f852b94ff6aab for T227376 committed August 7th.

Seems like the anonymous function misses a use ( $fname ).

Not a blocker, that predates 1.34.0-wmf.22?

Change 535902 had a related patch set uploaded (by Aaron Schulz; owner: Aaron Schulz):
[mediawiki/extensions/FlaggedRevs@master] Add missing "use" to getTopReviewers()

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

Krinkle assigned this task to aaron.Sep 11 2019, 9:29 PM
Krinkle triaged this task as Normal priority.
Krinkle added a project: Performance-Team.

Change 535902 merged by jenkins-bot:
[mediawiki/extensions/FlaggedRevs@master] Add missing "use" to getTopReviewers()

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

aaron closed this task as Resolved.Sep 11 2019, 11:53 PM

Change 537108 had a related patch set uploaded (by Hashar; owner: Aaron Schulz):
[mediawiki/extensions/FlaggedRevs@wmf/1.34.0-wmf.22] Add missing "use" to getTopReviewers()

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

Backported to 1.34.0-wmf.22

Change 537108 merged by jenkins-bot:
[mediawiki/extensions/FlaggedRevs@wmf/1.34.0-wmf.22] Add missing "use" to getTopReviewers()

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

Mentioned in SAL (#wikimedia-operations) [2019-09-16T13:28:45Z] <hashar@deploy1001> Synchronized php-1.34.0-wmf.22/extensions/FlaggedRevs/frontend/specialpages/reports/ValidationStatistics.php: Add missing "use" to getTopReviewers() - T232618 (duration: 00m 55s)