dolejska-daniel / riot-api

Riot League of Legends & DataDragon API wrappers for PHP7 and PHP8.
GNU General Public License v3.0
112 stars 25 forks source link

Undefined offset: -1 #17

Closed angelkurten closed 6 years ago

angelkurten commented 6 years ago
$games = $this->parseCollection($this->getMatchlistByAccount($user, [440, 420], null, null, null, null, null, $total)->matches);
        $details = new Collection();
        $games->each(function ($game) use ($details) {
            $details->push(
                $this->getMatch($game->gameId)
            );
        });

        return $details;

RESULT:

ErrorException (E_NOTICE) Undefined offset: -1

dolejska-daniel commented 6 years ago

Hello,

are you sure that it is a problem on side of the library? You are using a lot of own functions which I don't know, also the PHP error should tell you in which file and on which line the error occurred, could you show me?

angelkurten commented 6 years ago

Code: https://github.com/angelkurten/TrackerLOL/blob/master/app/Http/Controllers/UserController.php

LOLApi: https://github.com/angelkurten/TrackerLOL/blob/master/app/Riot/LOL.php

image

dolejska-daniel commented 6 years ago

Hi again,

could you provide me with raw RiotAPI response? Value -1 is very suspicious in this scenario.

The library is trying to link static champion data to the response, but its looking for champion with id -1, which of course does not exist. Question is, how did -1 get to the response data.

angelkurten commented 6 years ago

Solution: image

dolejska-daniel commented 6 years ago

Well, yeah, but that doesn't solve the problem itself. Could you find the raw data from the API for me?