Aws-sdk-php: Trying to access array offset on value of type null

Created on 3 Dec 2019  路  4Comments  路  Source: aws/aws-sdk-php

Please fill out the sections below to help us address your issue.

Version of AWS SDK for PHP?

3.125

Version of PHP (php -v)?

7.4

What issue did you see?

Trying to access array offset on value of type null in /srv/www/vendor/aws/aws-sdk-php/src/RetryMiddleware.php:146

Steps to reproduce

I don't currently have a good way to reproduce this.

But, looking at the RetryMiddleware class, there are many things to note. Firstly, it's not typed at all, so $result could literally be anything and it's not even verified to be a legitimate value before attempting to access array keys on it.

bug

Most helpful comment

We just merged a fix in #1916, which will be included in the next release. Thanks for bringing this to our attention!

All 4 comments

Having the same issue.
AWS SDK version 3.126.0
Laravel 6.6.1
PHP 7.4

I get the issue in this line $s3->createPresignedRequest($cmd, '+5 minutes'); in code snippet below

$cmd = $s3->getCommand('GetObject', [
 'Bucket' => env('AWS_BUCKET'),
 'Key'    => $mediaRecord->getPath(),
]);
$request = $s3->createPresignedRequest($cmd, '+5 minutes');

@SelimSalihovic you can set the retry attempts config on the S3Client to zero to bypass this for now. It's a hack that'll be okay in most cases, but it'll silence this error until this is resolved.

Getting the same thing as well, thanks for the hack @oojacoboo

We just merged a fix in #1916, which will be included in the next release. Thanks for bringing this to our attention!

Was this page helpful?
0 / 5 - 0 ratings