| thiemowmde updated the task description. (Show Details) |
CHANGES TO TASK DESCRIPTION
```
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 three DataValue classes:
* `GlobeCoordinateValue::newFromArray`
* `MonolingualTextValue::newFromArray`
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* `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.
#patch-for-review:
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 three DataValue classes:
* `GlobeCoordinateValue::newFromArray`
* `MonolingualTextValue::newFromArray`
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* `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.
#patch-for-review:
...
TASK DETAIL
EMAIL PREFERENCES
To: thiemowmde
Cc: thiemowmde, WMDE-leszek, Liuxinyu970226, Dereckson, JeroenDeDauw, Lucas_Werkmeister_WMDE, TerraCodes, Jay8g, greg, Addshore, aude, Stashbot, Aklapper, mmodell, GoranSMilovanovic, Jrbranaa, QZanden, Izno, Wikidata-bugs, Mbch331, Krenair
Cc: thiemowmde, WMDE-leszek, Liuxinyu970226, Dereckson, JeroenDeDauw, Lucas_Werkmeister_WMDE, TerraCodes, Jay8g, greg, Addshore, aude, Stashbot, Aklapper, mmodell, GoranSMilovanovic, Jrbranaa, QZanden, Izno, Wikidata-bugs, Mbch331, Krenair
_______________________________________________ Wikidata-bugs mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs
