Catchable fatal error: Argument 1 passed to DataValues\UnboundedQuantityValue::newFromArray() must be an instance of array, string given in /srv/mediawiki/php-1.30.0-wmf.6/extensions/Wikidata/vendor/data-values/serialization/src/Deserializers/DataValueDeserializer.php on line 141
We accidentally added strict array type hints to the newFromArray methods of some DataValue classes:
- GlobeCoordinateValue::newFromArray
- UnboundedQuantityValue::newFromArray
The only relevant caller of these methods is in DataValueDeserializer::getDeserialization. The caller can not know what the specific newFromArray method it is going to call expects. StringValue for example expects a string, while all more complex DataValues expect an array. Each individual newFromArray method must check if the value it gets matches the expected format, and throw a proper exception if not.
Adding the static array type hints was a mistake, mostly caused by the misleading name "newFromArray". What it means is "newFromIntermediateDeserialization". The provided value comes from an array (see DataValueObject::toArray), but must not be an array. This was never a problem as long as nobody tried to pass bad serializations to our code. This changed now because of a misbehaving bot.
- https://github.com/DataValues/Geo/pull/113
- We need to tag a bugfix release of data-values/geo then.
- https://github.com/DataValues/Number/pull/105
- https://github.com/DataValues/Number/pull/106
- https://github.com/DataValues/Number/pull/107
- We need to tag a bugfix release of data-values/number then.
- https://github.com/DataValues/Serialization/pull/29
- https://github.com/DataValues/Serialization/pull/30
- We should tag a bugfix release of data-values/serialization then.
Other components that should be updated too, but don't need an immediate bugfix release: