Page MenuHomePhabricator

query->globalblocks sometimes intersperses empty arrays in result if queried for range
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Go to https://meta.wikimedia.org/w/api.php?action=query&list=globalblocks&bglimit=500&bgprop=range&bgstart=2024-08-23T02:27:29Z

What happens?:

Observe that the first item in the globalblocks array is an empty array instead of an object.

What should have happened instead?:

There should be no empty array there.

Event Timeline

Count_Count renamed this task from query->globalblocks intersperse empty arrays in result if queried for range to query->globalblocks sometimes intersperses empty arrays in result if queried for range.Aug 26 2024, 5:55 AM
Count_Count updated the task description. (Show Details)

The example block mentioned above has ID 3260612.
I did a query on Toolforge replica DBs and it seems that the block is for a user but not a IP address/range.

Therefore, the IP ranges are not available and not added: https://gerrit.wikimedia.org/g/mediawiki/extensions/GlobalBlocking/+/5e4bb5e1b2c61b58ef9950e31d599dac707e4e66/includes/Api/ApiQueryGlobalBlocks.php#220.

However I think the empty array should be serialized as a JSON object but not an array.

Change #1066588 had a related patch set uploaded (by XtexChooser; author: XtexChooser):

[mediawiki/extensions/GlobalBlocking@master] Mark globalblocks query results as associated

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

Change #1066588 merged by jenkins-bot:

[mediawiki/extensions/GlobalBlocking@master] Mark globalblocks query results as associated

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

Djackson-ctr subscribed.

QA has been completed and the new code is functioning and displaying as expected.

image.png (574×850 px, 22 KB)