Jump to content

Wikidata For Wikimedia Projects/Projects/get All Statements

From Meta, a Wikimedia project coordination wiki
Tracked in Phabricator:
Task T270851

getAllStatements does not make a copy of returned values, getBestStatements does.

Background

The functions getAllStatements and getBestStatements are similar in behaviour but one function returns a list of direct Property-values whilst the other returns a copy of the list of Property-values.

The Problem

[edit]

Direct values can be edited on the native Wiki page where the function getAllStatements has been invoked. If a returned property-value was changed and then the function was invoked again, this new value would be temporarily altered.

The Solution

[edit]

Changing the getAllStatements behaviour of how values are returned to match getBestStatements, returning a copy of object values rather than directly returning them. This prevents the values from being temporarily altered from the native environment they are being invoked from.

Next Steps

[edit]
  • Logic of getAllStatements changed to behave as getBestStatements in (1.44.0-wmf-2), deployed to all Wikis by 07.11.24.