NicklasWallgren / PokemonGoAPI-PHP

Pokemon Go API PHP library
BSD 2-Clause "Simplified" License
130 stars 51 forks source link

Incorrect wire format for field 8 #153

Closed zunfix closed 7 years ago

zunfix commented 7 years ago

Hi,

When reading informations from Niantic, I got this error :

Fatal error: Uncaught Exception: Incorrect wire format for field 8, expected: 0 got: 2 in C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\POGOProtos\Data\PokemonData.php:127 Stack trace:

0 C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\protocolbuffers.inc.php(84): POGOProtos\Data\PokemonData->read(Resource id #166, 128)

1 C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\POGOProtos\Data\PokemonData.php(51): ProtobufMessage->__construct(Resource id #166, 128)

2 C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\POGOProtos\Inventory\InventoryItemData.php(48): POGOProtos\Data\PokemonData->__construct(Resource id #166, 128)

3 C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\protocolbuffers.inc.php(84): POGOProtos\Inventory\InventoryItemData->read(Resource id #166, 0)

4 C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\POGOProtos\Inventory\InventoryItemData.php(30): ProtobufMessage->__construct(Resource id #166, 0)

5 C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\POGOProt in C:\WTServer\WWW\pogo\vendor\nicklasw\pogoprotos-php\src\POGOProtos\Data\PokemonData.php on line 127

I think this issue could be related to Pokemons deployed in Gyms ? I have one deployed in gym ....

I use version "d90e26ed5e94da9c92ce35eb67f4197eaa161ada" of the API.

Xavier.

DrDelay commented 7 years ago

The version of this repo you are using is OK, but you should check the version of the NicklasWallgren/pogoprotos-php dependency. It should be at least https://github.com/NicklasWallgren/pogoprotos-php/commit/5405893495bc48ae75b3bbe8db3b91623f2f4175 - wire format 2 is correct.

Just run composer update to get the latest version.

zunfix commented 7 years ago

It works now.

Very fast and clear answer. Thanks a lot.