If you see this error after migrating from the v2 to v3 sdk change:
$s3client->deleteObjects( array(
'Bucket' => $settings['bucket'],
'Objects' => $fileKeys
) );
to:
$s3client->deleteObjects( array(
'Bucket' => $settings['bucket'],
'Delete' => array(
'Objects' => $fileKeys
)
) );
Note the new Delete array wrapping Objects. I discovered this while updating BackupBuddy.
Catchable fatal error: Argument 2 passed to Guzzle\Service\Client::getCommand() must be of the type array, string given, called in ../_s3lib2/Guzzle/Service/Client.php on line 76 and defined in ../_s3lib2/Guzzle/Service/Client.php on line 79
If you’re getting this error when working with the version 2 PHP SDK for Amazon Web Services’ S3 service, fear not. It’s probably as simple as you passing the wrong parameters into the function. In this example I was calling listObjects() using the old SDK’s parameters rather than the new SDK’s. Simply fix!
Wrong (eg. old SDK v1 way):
$response = self::$_client->listObjects( $settings['bucket'] );
Right (eg. new SDK v2 way):
$response = self::$_client->listObjects( array( 'Bucket' => $settings['bucket'], 'Prefix' => $prefix ) );
All fixed!
Dustin Bolton – Software Engineer, Web & WordPress Developer