Page MenuHomePhabricator

Invalid GeoCoordinateValue fatal error
Closed, ResolvedPublic

Description

If I give the api (e.g. CreateClaim) an invalid value for geocoordinate, it does not get validated. Instead it fails hard with a fatal error, which gets returned back to me, the bot / api user as a stack trace and obviously gets logged.

I am told that the same error is appearing in the production fatal logs, therefore if there is a reasonable way that we can patch it, we should and backport it asap.

A more overall approach to better value validation, as described in bug 49263, is needed soon as possible though would be too drastic of a change for backporting.

PHP Catchable fatal error: Argument 1 passed to DataValues\\GeoCoordinateValue::newFromArray() must be an array, null given, called in /var/www/common/wikibase-repo/extensions/DataValues/DataValues/includes/DataValueFactory.php on line 102 and defined in /var/www/common/wikibase-repo/extensions/DataValues/DataValues/includes/values/GeoCoordinateValue.php on line 281
PHP Stack trace:
PHP 1. {main}() /var/www/common/wikibase-repo/api.php:0
PHP 2. ApiMain->execute() /var/www/common/wikibase-repo/api.php:73
PHP 3. ApiMain->executeActionWithErrorHandling() /var/www/common/wikibase-repo/includes/api/ApiMain.php:351
PHP 4. ApiMain->executeAction() /var/www/common/wikibase-repo/includes/api/ApiMain.php:380
PHP 5. Wikibase\\Api\\CreateClaim->execute() /var/www/common/wikibase-repo/includes/api/ApiMain.php:840
PHP 6. Wikibase\\Api\\CreateClaim->getSnakInstance() /var/www/common/wikibase-repo/extensions/Wikibase/repo/includes/api/CreateClaim.php:67
PHP 7. Wikibase\\SnakFactory->newSnak() /var/www/common/wikibase-repo/extensions/Wikibase/repo/includes/api/CreateClaim.php:190
PHP 8. Wikibase\\PropertyValueSnak::newFromPropertyValue() /var/www/common/wikibase-repo/extensions/Wikibase/DataModel/DataModel/Snak/SnakFactory.php:53
PHP 9. Wikibase\\Property->newDataValue() /var/www/common/wikibase-repo/extensions/Wikibase/DataModel/DataModel/Snak/PropertyValueSnak.php:151
PHP 10. DataValues\\DataValueFactory->newDataValue() /var/www/common/wikibase-repo/extensions/Wikibase/DataModel/DataModel/Entity/Property.php:177
PHP 11. DataValues\\GeoCoordinateValue::newFromArray() /var/www/common/wikibase-repo/extensions/DataValues/DataValues/includes/DataValueFactory.php:102

Depending on what I feed the api, am also able to get:

PHP Catchable fatal error: Argument 1 passed to DataValues\\GeoCoordinateValue::newFromArray() must be an array, string given, called in /var/www/common/wikibase-repo/extensions/DataValues/DataValues/includes/DataValueFactory.php on line 102 and defined in /var/www/common/wikibase-repo/extensions/DataValues/DataValues/includes/values/GeoCoordinateValue.php on line 281


Version: master
Severity: normal

Details

Reference
bz49498

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 1:44 AM
bzimport set Reference to bz49498.
bzimport added a subscriber: Unknown Object (MLST).
aude created this task.Jun 12 2013, 7:55 PM

Related URL: https://gerrit.wikimedia.org/r/68367 (Gerrit Change I4d6b27adfd8f8f6320c5029fde0a6a2a835c31d6)

Related URL: https://gerrit.wikimedia.org/r/68369 (Gerrit Change I09e54dca33a3d143b1fa0d2f6ccf331ba8241a36)

This is caused by a) overly restrictive type hinting in the DataValues extension and b) missing error handling in the Api modules. I see no way to address this with a live hack. Since this does not cause corruption on the only issue is a "dirty" error report, I suggest to leave this for the next deployment.

https://gerrit.wikimedia.org/r/68367 (Gerrit Change I4d6b27adfd8f8f6320c5029fde0a6a2a835c31d6) | change APPROVED and MERGED [by Jeroen De Dauw]

https://gerrit.wikimedia.org/r/68369 (Gerrit Change I09e54dca33a3d143b1fa0d2f6ccf331ba8241a36) | change APPROVED and MERGED [by Jeroen De Dauw]

Verified in Wikidata demo sprint 22-9