mardi 26 mai 2015

I get the following errors when I try to use the AWS PHP SDK:

PHP Warning:  Illegal string offset 'client.backoff' in C:\xampp\htdocs\aws_test_local\vendor\aws\aws-sdk-php\src\Aws\S3\S3Client.php on line 172

PHP Catchable fatal error:  Object of class Guzzle\Plugin\Backoff\BackoffPlugin could not be converted to string in C:\xampp\htdocs\aws_test_local\vendor\aws\aws-sdk-php\src\Aws\S3\S3Client.php on line 172

PHP Warning:  Illegal string offset 'signature' in C:\xampp\htdocs\aws_test_local\vendor\aws\aws-sdk-php\src\Aws\S3\S3Client.php on line 175

PHP Catchable fatal error:  Object of class Aws\S3\S3Signature could not be converted to string in C:\xampp\htdocs\aws_test_local\vendor\aws\aws-sdk-php\src\Aws\S3\S3Client.php on line 175

They originate from the following code inside the S3Client.php file part of the AWS SDK.

public static function factory($config = array())
{
    $exceptionParser = new S3ExceptionParser();

    // Configure the custom exponential backoff plugin for retrying S3 specific errors
    if (!isset($config[Options::BACKOFF])) {
        $config[Options::BACKOFF] = static::createBackoffPlugin($exceptionParser);
    }

    $config[Options::SIGNATURE] = $signature = static::createSignature($config);
...

So when it tries to write out Options::BACKOFF and Options::SIGNATURE as keys of the $config array, it makes an error.

I call the factory function in the following way:

$s3 = S3Client::factory(_PS_ROOT_DIR_.'/override/aws/aws-config.php');

My aws-config.php file looks like this:

<?php

    return array(
        'includes' => array('_aws'),
        'services' => array(
            'default_settings' => array(
                'params' => array(
                    'key'    => 'XXXXXXXXXXX',
                    'secret' => 'XXXXXXXXXXX',
                    'region' => 'eu-west-1'
                )
            )
        )
    );

?>

Any ideas? I installed the PHP SDK with Composer, so I'd expect any dependancies to be installed.




Aucun commentaire:

Enregistrer un commentaire