Page MenuHomePhabricator

Hashes of globe-coordinates are sensitive to serialize_precision ini setting.
Closed, ResolvedPublic

Description

GlobeCoordinateValue use floats to represent latitude, longitude, and precision. Floats are used in fields internally, as well as in the array representation returned by getArrayValue(), which in turn is used by serialize() to build JSON a JSON string.

serialize() and json_encode() both rely on serialize_precision ini setting http://php.net/manual/de/ini.core.php#ini.serialize-precision.

The getHash() method of GlobeCoordinateValue in turn relies on serialize().

This means that the same GlobeCoordinateValue will return different hashes depending on the value of serialize_precision.

This can make tests fail for no obvious reasons, and it means the hashes we expose in our JSON dumps, in the API, and in our RDF mapping cannot be reproduced reliably, even using our own code.

Related issue: T116683: PHP setting serialize_precision may influence unit tests when serialize() is used.

Patch-For-Review:

Event Timeline

Change 344446 had a related patch set uploaded (by Daniel Kinzler):
[mediawiki/extensions/Wikibase@master] Use uncritical floatvalues for RDF test data

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

Change 344383 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
[mediawiki/extensions/Wikibase@master] Remove incompatible floating point numbers from all RDF tests

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

thiemowmde updated the task description. (Show Details)
thiemowmde added a subscriber: JeroenDeDauw.

Change 344446 abandoned by Daniel Kinzler:
Use uncritical floatvalues for RDF test data

Reason:
Use I39185f instead

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

Change 344383 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Remove incompatible floating point numbers from all RDF tests

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

All patches mentioned in the task description have been either merged or dropped. That means now the new release of DataValues/Geo is needed, and that would be it? Or is there anything else here, which was not mentioned so far?

thiemowmde removed a project: Patch-For-Review.
thiemowmde updated the task description. (Show Details)
thiemowmde moved this task from Review to Done on the Wikidata-Former-Sprint-Board board.
thiemowmde moved this task from incoming to in progress on the Wikidata board.