1

We are using the Google Drive API for PHP in our web application, and although listing, inserting and deleting work just fine, we keep getting these warnings when using the list() method:

$google_return = $GoogleAPI['Drive']->files->list();

causes these two warnings to appear:

Warning: Invalid argument supplied for foreach() in (...)lib/php/GOOGLE/service/Google_ServiceResource.php on line 108
Warning: Invalid argument supplied for foreach() in (...)lib/php/GOOGLE/io/Google_REST.php on line 92

I tried modifying the API files themselves and added an is_array check before that foreach, to no avail.

Any ideas?

Thanks!

EDIT: The client API is downloaded from here http://code.google.com/p/google-api-php-client/

The below code causes a warning, so I added the is_array check but that didn't eliminate it.

$method['parameters'] = array_merge($method['parameters'], $this->stackParameters);
if (is_array ($parameters) {
     foreach ($parameters as $key => $val) {
        if ($key != 'postBody' && ! isset($method['parameters'][$key])) {
          throw new Google_Exception("($name) unknown parameter: '$key'");
        }
     }
}
Octahedron
  • 893
  • 2
  • 16
  • 31
SheepEater
  • 11
  • 3
  • 1
    You should probably add more code to your question. As a starter, provide a URL where you can download that API. And probably show your fix that doesn't work. – Sven Jul 08 '13 at 16:07
  • Should you not be iterating `$method['parameters']` rather than `$parameters`? – AlexP Jul 08 '13 at 16:17
  • Hi. This is code from the google API client, not mine. I'm not even supposed to modify it. The is_array check was added just to try and eliminate the warning. My code is : $google_return = $GoogleAPI['Drive']->files->list(); – SheepEater Jul 08 '13 at 16:22

0 Answers0