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

Issue with getMatch endpoint #75

Closed elreco closed 4 years ago

elreco commented 4 years ago

Hi!

Sometimes when I try to retrieve a match with the getMatch function I got this error :

Argument 1 passed to RiotAPI\LeagueAPI\Objects\ApiObject::__construct() must be of the type array, boolean given, called in E:\Programmes\laragon\www\probuilds\vendor\dolejska-daniel\riot-api\src\LeagueAPI\LeagueAPI.php on line 1995

The $result variable is false in the getStaticChampion function

My endpoint is : "/lol/match/v4/matches/4476606456"

Do you know why?

Thank you! :)

dolejska-daniel commented 4 years ago

That could happen when the request fails or rather doesnt return anything.. Is the ID and region correctly set?

elreco commented 4 years ago

Here is my init setting :

$this->riot = new LeagueAPI([
        LeagueAPI::SET_KEY              => env('RIOT_API_KEY'),
        LeagueAPI::SET_TOURNAMENT_KEY   => "",
        LeagueAPI::SET_REGION           => Region::EUROPE_WEST,
        LeagueAPI::SET_VERIFY_SSL       => false,
        LeagueAPI::SET_DATADRAGON_INIT  => true,
        LeagueAPI::SET_STATICDATA_LINKING => true,
        LeagueAPI::SET_INTERIM          => true,
        LeagueAPI::SET_CACHE_RATELIMIT  => true,
        LeagueAPI::SET_CACHE_CALLS      => true,
        LeagueAPI::SET_CACHE_CALLS_LENGTH=> 9999
]);

and I get the match ID using getMatchlistByAccount.

the result :

9ca7dc37a1f7de752b6277ba805dfe45

dolejska-daniel commented 4 years ago

Could you try without LeagueAPI::SET_STATICDATA_LINKING?

dolejska-daniel commented 4 years ago

If it works try pulling latest version from master, it should be fixed there 😺

elreco commented 4 years ago

It works with the latest version from master! thank you

dolejska-daniel commented 4 years ago

Happy to help!