Page MenuHomePhabricator

Read new cannot parse the log_params of global block log entries
Closed, ResolvedPublicBUG REPORT

Description

What is the problem?

If $wgCheckUserEventTablesMigrationStage contains SCHEMA_COMPAT_READ_NEW, when viewing the log entry for a global block in Special:CheckUser, I see warnings of the form:

Notice: unserialize(): Error at offset 0 of n bytes in /var/www/html/w/includes/logging/LogEntryBase.php on line 70

The log entry does not display the block params, instead just displaying ()

In the logging table, global block stores a string in the log_params column, rather than a json(?) object. For example,

+----------+------------+----------------------------------------------+
| log_type | log_action | log_params                                   |
+----------+------------+----------------------------------------------+
| gblblock | gblock2    | anonymous only, no expiration set
3.1.1.1/32 |
+----------+------------+----------------------------------------------+
Steps to reproduce problem
  1. Install the CheckUser and GlobalBlocking extensions (instructions for docker for CheckUser and GlobalBlocking)
  2. Add this to your LocalSettings.php: $wgCheckUserEventTablesMigrationStage = SCHEMA_COMPAT_WRITE_OLD | SCHEMA_COMPAT_WRITE_NEW | SCHEMA_COMPAT_READ_NEW;
  3. Login as an admin, go to Special:GlobalBlock and block any IP address
  4. Go to Special:CheckUser, enter your admin username, check "get edits" and submit

Expected behavior: You should see an entry of the form <admin> globally blocked User:<ip> (no expiration set) or <admin> globally blocked User:<ip> (expiration 13:22, 27 September 2023)
Observed behavior: At the top of the page you will see warnings like in the description. The log entry will be something like <admin> globally blocked User:<ip> ()

Environment

Wiki(s): local docker CheckUser 2.5 (b31ab64) 16:50, 25 September 2023.

Screenshots

Read old:

parse_global_block_params_read_old.png (96×988 px, 35 KB)

Read new:

parse_global_block_params_read_new.png (93×986 px, 32 KB)

Related Objects

StatusSubtypeAssignedTask
ResolvedSecurityZabe
ResolvedSecurityDreamy_Jazz
ResolvedSecurityDreamy_Jazz
ResolvedSecurityDreamy_Jazz
OpenBUG REPORTNone
ResolvedBUG REPORTDreamy_Jazz
OpenBUG REPORTDreamy_Jazz
ResolvedDreamy_Jazz
OpenNone
OpenNone
OpenNone
OpenFeatureDreamy_Jazz
DuplicateNone
OpenFeatureNone
OpenFeatureNone
OpenFeatureNone
ResolvedFeatureDreamy_Jazz
ResolvedFeatureDreamy_Jazz
ResolvedFeatureDreamy_Jazz
OpenFeatureNone
OpenFeatureNone
ResolvedBUG REPORTDreamy_Jazz
OpenFeatureNone
OpenFeatureNone
ResolvedGlaisher
OpenNone
ResolvedFeatureDreamy_Jazz
ResolvedGlaisher
ResolvedNiharika
ResolvedNone
ResolvedFeatureDreamy_Jazz
DeclinedNone
ResolvedFeatureDreamy_Jazz
ResolvedFeatureDreamy_Jazz
DuplicateNone
OpenNone
DuplicateNone
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedDreamy_Jazz
OpenFeatureNone
ResolvedDreamy_Jazz
ResolvedBUG REPORTDreamy_Jazz
ResolvedBUG REPORTDreamy_Jazz
OpenNone
OpenFeatureNone
DeclinedFeatureNone
OpenFeatureNone
ResolvedDreamy_Jazz
Resolved kostajh
OpenNone
OpenNone
Resolved tstarling
OpenNone
ResolvedTchanders
OpenBUG REPORTNone
OpenFeatureDreamy_Jazz
ResolvedDreamy_Jazz
ResolvedBUG REPORTDreamy_Jazz

Event Timeline

@dom_walden can you click on the "log" link and see what appears there? Specially I want to check if the E_NOTICE is also displayed for that log entry on Special:Log.

I've managed to re-produce this and found the issue here.

The issue here is that the DatabaseLogEntry::getParameters method can handle legacy log events but the ManualLogEntry::getParameters method cannot.

Change 961127 had a related patch set uploaded (by Dreamy Jazz; author: Dreamy Jazz):

[mediawiki/extensions/CheckUser@master] Use LogPage::extractParams for legacy log parameters

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

Change 961127 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Use LogPage::extractParams for legacy log parameters

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

Special:CheckUser now correctly parses a variety of log parameters, including those that use the legacy log params such as global block and interwiki. I did not see any errors or warnings on the page or in the logs.

Test environment: local docker (mysql) CheckUser 2.5 (4198716) 21:13, 29 September 2023.