-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugThis issue is a bug.This issue is a bug.p3This is a minor priority issueThis is a minor priority issuequeuedThis issues is on the AWS team's backlogThis issues is on the AWS team's backlog
Description
Describe the bug
The method AwsClientTrait::__call always looks for $args[0] but when using named arguments, they will exist as $args['args'] instead.
For example:
$client->createBucket(args: ["Bucket" => "some-bucket-name"]);
This will throw an exception with message:
Aws\\S3\\S3Client::isDirectoryBucket(): Argument #1 ($bucket) must be of type string, null given, called in \/var\/www\/html\/vendor\/aws\/aws-sdk-php\/src\/S3\/S3Client.php on line 734
As a workaround, I've used this snippet in projects that have strict ruling around named arguments:
use Aws\S3\S3Client as OriginalClient;
class S3Client extends OriginalClient {
public function __call($name, array $args) {
return parent::__call($name, [$args["args"]]);
}
}Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
Full named arguments support matching the generation documentation and types.
Current Behavior
Exception thrown when using named arguments:
Aws\\S3\\S3Client::isDirectoryBucket(): Argument #1 ($bucket) must be of type string, null given, called in \/var\/www\/html\/vendor\/aws\/aws-sdk-php\/src\/S3\/S3Client.php on line 734
Reproduction Steps
Attempt to run any method that ends up hitting AwsClientTrait::__call method
Possible Solution
Changing:
# in AwsClientTrait::__call
$params = isset($args[0]) ? $args[0] : [];To:
# in AwsClientTrait::__call
$params = $args['args'] ?? $args[0] ?? [];Additional Information/Context
No response
SDK version used
3.369.25
Environment details (Version of PHP (php -v)? OS name and version, etc.)
PHP 8.4.15 - Debian GNU/Linux 13 (trixie) - Running in docker from php:8.4-fpm image
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugThis issue is a bug.This issue is a bug.p3This is a minor priority issueThis is a minor priority issuequeuedThis issues is on the AWS team's backlogThis issues is on the AWS team's backlog