aws / aws-sdk-php

Official repository of the AWS SDK for PHP (@awsforphp)
http://aws.amazon.com/sdkforphp
Apache License 2.0
6.03k stars 1.22k forks source link

Shared config files still checked despite "use_aws_shared_config_files" = false #3026

Open markinjapan opened 1 day ago

markinjapan commented 1 day ago

Describe the bug

The use_aws_shared_config_files config setting is not respected when resolving the following client configuration options:

This causes the ConfigurationResolver::resolve() function to check for ~/.aws/config files unnecessarily.

Regression Issue

Expected Behavior

By setting the use_aws_shared_config_files config option, when all other config options are resolved, the shared config files should never be checked.

Current Behavior

Currently shared config files are checked for region and sigv4a_signing_region_set.

Reproduction Steps

// Create S3 client
$s3_client = new Aws\S3\S3Client([
    'region' => 'ap-northeast-1',
    'credentials' => new Aws\Credentials\Credentials(
        'MYAWSKEY',
        'xxxxxxxxxxxxxxxx'
    ),
    'version' => '2006-03-01',
    'use_aws_shared_config_files' => false,
]);

Possible Solution

In the methods ClientResolver::_default_sigv4a_signing_region_set() and ClientResolver::_default_region(), the $args argument is not being passed to the ConfigurationResolver::resolve() method.

This means the config option use_aws_shared_config_files is not respected.

Additional Information/Context

No response

SDK version used

3.326.0

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

PHP 8.3.13, MacOS 15.1 (24B83)

yenfryherrerafeliz commented 1 day ago

Hi @markinjapan, thanks for reporting this. I have opened a PR to address this issue.

Thanks!