edwardspec / mediawiki-moderation

Extension:Moderation is a powerful anti-spam extension for MediaWiki CMS. It protects small/medium wikis against vandalism by sending all edits/uploads from new users to moderation.
https://mediawiki.org/wiki/Extension:Moderation
GNU General Public License v3.0
30 stars 22 forks source link

ErrorException from line 445 of /srv/mediawiki/w/extensions/Moderation/hooks/ModerationApproveHook.php: PHP Notice: Undefined index: rc_log_action #59

Closed paladox closed 3 years ago

paladox commented 3 years ago

Hi, in the log I'm seeing:

/w/api.php   ErrorException from line 445 of /srv/mediawiki/w/extensions/Moderation/hooks/ModerationApproveHook.php: PHP Notice: Undefined index: rc_log_action

Trace back:

["/srv/mediawiki/w/extensions/Moderation/hooks/ModerationApproveHook.php:445","/srv/mediawiki/w/extensions/Moderation/hooks/ModerationApproveHook.php:484","/srv/mediawiki/w/extensions/Moderation/hooks/ModerationApproveHook.php:473","/srv/mediawiki/w/includes/HookContainer/HookContainer.php:320","/srv/mediawiki/w/includes/HookContainer/HookContainer.php:131","/srv/mediawiki/w/includes/Hooks.php:137","/srv/mediawiki/w/extensions/CheckUser/includes/CheckUserHooks.php:152","/srv/mediawiki/w/includes/HookContainer/HookContainer.php:320","/srv/mediawiki/w/includes/HookContainer/HookContainer.php:131","/srv/mediawiki/w/includes/HookContainer/HookRunner.php:3192","/srv/mediawiki/w/includes/changes/RecentChange.php:396","/srv/mediawiki/w/extensions/Flow/includes/Data/Listener/RecentChangesListener.php:123","/srv/mediawiki/w/extensions/Flow/includes/Data/Listener/DeferredInsertLifecycleHandler.php:36","/srv/mediawiki/w/includes/deferred/MWCallableUpdate.php:38","/srv/mediawiki/w/includes/deferred/DeferredUpdates.php:467","/srv/mediawiki/w/includes/deferred/DeferredUpdates.php:344","/srv/mediawiki/w/includes/deferred/DeferredUpdates.php:278","/srv/mediawiki/w/includes/deferred/DeferredUpdates.php:194","/srv/mediawiki/w/includes/MediaWiki.php:1113","/srv/mediawiki/w/includes/MediaWiki.php:849","/srv/mediawiki/w/includes/MediaWiki.php:861","/srv/mediawiki/w/api.php:125","/srv/mediawiki/w/api.php:45"]
edwardspec commented 3 years ago

Investigating.

edwardspec commented 3 years ago

Some third-party extension (most likely Flow) is constructing RecentChange object without $rc->mAttribs['rc_log_action'] (MediaWiki core always sets this field to empty string for non-logs)

I will fix it by replacing

$logAction = $rc->mAttribs['rc_log_action'];

with

$logAction = $rc->mAttribs['rc_log_action'] ?? '';

It might take some time to commit this change (sorry for the delay), because Travis CI is broken (they discontinued their plan for opensource projects), so I would need to get the testsuite running on GitHub Actions first.

paladox commented 3 years ago

Thanks!