Page MenuHomePhabricator

Handle ipoid api returning invalid data
Closed, DeclinedPublicBUG REPORT

Description

What is the problem?

IPInfo now makes a request to ipoid's api for some of its data. If the ipoid api response has data in unexpected formats, IPInfo will throw an exception such as:

Error: exception of type TypeError: Argument 1 passed to MediaWiki\\IPInfo\\Info\\IPoidInfo::__construct() must be of the type array or null, string given, called in /var/www/html/w/extensions/IPInfo/src/InfoRetriever/IPoidInfoRetriever.php on line 87

Further to T349723#9453323.

Steps to reproduce problem
  1. Download
  2. Put it in extensions/IPInfo/tests/phpunit/integration/
  3. Run: docker compose exec mediawiki composer phpunit:entrypoint -- extensions/IPInfo/tests/phpunit/integration/IPoidInfoRetrieverTestReprod.php

Expected behaviour: phpunit will run and report green
Observed behaviour: phpunit will report red and print various exceptions

Environment

IPInfo 0.0.0 (19f6b7f) 08:17, 19 January 2024.