Skip to content

Invalid argument supplied for foreach() #124

Description

@ilumos

Hey folks,

When calling Steam::app()->appDetails(1444140) I get the error:

ErrorException

 Invalid argument supplied for foreach()

 at vendor/syntax/steam-api/src/Syntax/SteamApi/Steam/App.php:79
   75|     protected function convertGames($apps)
   76|     {
   77|         $convertedApps = new Collection();
   78|
 > 79|         foreach ($apps as $app) {
   80|             if (isset($app->data)) {
   81|                 $convertedApps->add(new AppContainer($app->data));
   82|             }
   83|         }

I expect this is because Steam's API is returning an empty response with HTTP 200 OK.

Would it be appropriate to check for an empty response in setUpClient and if one is found, throw an ApiCallFailedException?

If so I will submit a PR.

Thank you for your great library!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions