diff --git a/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php b/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php index a71c1db899..b42c3c429f 100644 --- a/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php +++ b/src/Aws/S3/Model/MultipartUpload/ParallelTransfer.php @@ -90,9 +90,9 @@ protected function transfer() /** @var \Guzzle\Service\Command\OperationCommand $command */ foreach ($this->client->execute($commands) as $command) { $this->state->addPart(UploadPart::fromArray(array( - 'PartNumber' => count($this->state) + 1, + 'PartNumber' => $command['PartNumber'], 'ETag' => $command->getResponse()->getEtag(), - 'Size' => (int) $command->getResponse()->getContentLength(), + 'Size' => (int) $command->getRequest()->getBody()->getContentLength(), 'LastModified' => gmdate(DateFormat::RFC2822) ))); $eventData['command'] = $command; diff --git a/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php b/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php index 4a5953f5b2..2840dd5cb9 100644 --- a/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php +++ b/src/Aws/S3/Model/MultipartUpload/SerialTransfer.php @@ -73,7 +73,7 @@ protected function transfer() $response = $command->getResponse(); $this->state->addPart(UploadPart::fromArray(array( - 'PartNumber' => count($this->state) + 1, + 'PartNumber' => $command['PartNumber'], 'ETag' => $response->getEtag(), 'Size' => $body->getContentLength(), 'LastModified' => gmdate(DateFormat::RFC2822) diff --git a/tests/Aws/Tests/S3/Integration/IntegrationTest.php b/tests/Aws/Tests/S3/Integration/IntegrationTest.php index 985d918c84..4c13a6e619 100644 --- a/tests/Aws/Tests/S3/Integration/IntegrationTest.php +++ b/tests/Aws/Tests/S3/Integration/IntegrationTest.php @@ -359,7 +359,7 @@ public function testPutObjectAcl() )); $result = $command->execute(); $this->assertContains('Grantee', (string) $command->getRequest()->getBody()); - $this->assertEquals(array('RequestId'), array_keys($result->toArray())); + $this->assertArrayHasKey('RequestId', array_keys($result->toArray())); // Ensure that the RequestId model value is being populated correctly $this->assertEquals((string) $command->getResponse()->getHeader('x-amz-request-id'), $result['RequestId']); } @@ -503,7 +503,7 @@ public function testMultipartUploads() 'UploadId' => $uploadId )); $result = $command->execute(); - $this->assertEquals(array('RequestId'), array_keys($result->toArray())); + $this->assertArrayHasKey('RequestId', array_keys($result->toArray())); } /**