You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When relationships with multiple accounts are requested, but not all accounts have a relationship with the requesting account, the resulting array may contain gaps, and is incorrectly serialized: for example, when requesting 3 accounts like /api/v1/accounts/relationships?id%5B%5D=644249863538274110&id%5B%5D=676701638882780286&id%5B%5D=560748040462586535, and there's no relationship with the middle one, this JSON results:
This is a classic PHP issue and can probably be fixed by calling array_values on the response to renumber it, which should cause it to be serialized as an actual array instead of an object.
The text was updated successfully, but these errors were encountered:
VyrCossont
changed the title
Mastodon API: relationships endpoint can return object instead of array
Mastodon API: relationships endpoint should never return object instead of array
Mar 23, 2024
When relationships with multiple accounts are requested, but not all accounts have a relationship with the requesting account, the resulting array may contain gaps, and is incorrectly serialized: for example, when requesting 3 accounts like
/api/v1/accounts/relationships?id%5B%5D=644249863538274110&id%5B%5D=676701638882780286&id%5B%5D=560748040462586535
, and there's no relationship with the middle one, this JSON results:The correct response in this case would be:
This is a classic PHP issue and can probably be fixed by calling
array_values
on the response to renumber it, which should cause it to be serialized as an actual array instead of an object.The text was updated successfully, but these errors were encountered: