Skip to content

PHP 8.5 deprecation warning when using S3's determineBucketRegion method #3217

@rameshvenk

Description

@rameshvenk

Describe the bug

When using the S3 module, the following deprecation warning is printed

PHP Deprecated:  Using null as an array offset is deprecated, use an empty string instead in /tmp/php/vendor/aws/aws-sdk-php/src/RetryMiddleware.php on line 166

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Fix deprecation when using php 8.5

Current Behavior

The code runs fine, but a warning is printed

PHP Deprecated:  Using null as an array offset is deprecated, use an empty string instead

Reproduction Steps

<?php
require_once __DIR__ . '/vendor/autoload.php';

use Aws\S3\S3Client;


$all_buckets = [];
$s3 = new S3Client(
    [
        'version' => 'latest',
        'region' => 'us-east-1'
    ]
);

$paginator = $s3->getPaginator("ListBuckets");
foreach ($paginator as $page) {
    foreach ($page['Buckets'] as $bucket) {
      $s3->determineBucketRegion($bucket['Name']); // <-- this seems to be triggering the error
    }
}

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.363.0

Environment details (Version of PHP (php -v)? OS name and version, etc.)

PHP 8.5.0 on MacOS M1, Sequoia 15.7.1

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.queuedThis issues is on the AWS team's backlog

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions