tencentyun / cos-php-sdk-v5

cos-php-sdk-v5
MIT License
183 stars 82 forks source link

ListBuckets接口返回结果不一致 #324

Closed myxingkong closed 1 year ago

myxingkong commented 1 year ago

SDK版本:v2.6.6 测试代码:

<?php

require_once 'autoload.php';

use Qcloud\Cos\Client;

$client = new Client([
    'region' => 'ap-guangzhou',
    'schema' => 'https',
    'credentials' => [
        'secretId' => 'xxxxx',
        'secretKey' => 'xxxxx'
    ]
]);

$result = $client->listBuckets();
print_r($result->toArray()['Buckets']);

当前账号下只存在一个存储桶时输出结果:

Array
(
    [0] => Array
        (
            [Bucket] => Array
                (
                    [Name] => myBucket-1250000000
                    [Location] => ap-guangzhou
                    [CreationDate] => 2022-05-12T02:27:57Z
                    [BucketType] => cos
                )

        )

)

当前账号下存在一个存储桶以上时输出结果

Array
(
    [0] => Array
        (
            [Bucket] => Array
                (
                    [0] => Array
                        (
                            [Name] => test-1250000000
                            [Location] => ap-nanjing
                            [CreationDate] => 2023-10-08T10:36:15Z
                            [BucketType] => cos
                        )

                    [1] => Array
                        (
                            [Name] => myBucket-1250000000
                            [Location] => ap-guangzhou
                            [CreationDate] => 2022-05-12T02:27:57Z
                            [BucketType] => cos
                        )

                )

        )

)