Skip to content

Commit e4628d2

Browse files
authored
Fix the parsing of long values in headers (#1478)
1 parent ec96c33 commit e4628d2

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/CodeGenerator/src/Generator/CodeGenerator/TypeGenerator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public function getFilterConstant(Shape $shape): ?string
171171
{
172172
switch ($shape->getType()) {
173173
case 'integer':
174+
case 'long':
174175
return 'FILTER_VALIDATE_INT';
175176
case 'boolean':
176177
return 'FILTER_VALIDATE_BOOLEAN';

src/Service/S3/src/Result/GetObjectOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ protected function populateResult(Response $response): void
506506
$this->expiration = $headers['x-amz-expiration'][0] ?? null;
507507
$this->restore = $headers['x-amz-restore'][0] ?? null;
508508
$this->lastModified = isset($headers['last-modified'][0]) ? new \DateTimeImmutable($headers['last-modified'][0]) : null;
509-
$this->contentLength = $headers['content-length'][0] ?? null;
509+
$this->contentLength = isset($headers['content-length'][0]) ? filter_var($headers['content-length'][0], \FILTER_VALIDATE_INT) : null;
510510
$this->etag = $headers['etag'][0] ?? null;
511511
$this->checksumCrc32 = $headers['x-amz-checksum-crc32'][0] ?? null;
512512
$this->checksumCrc32C = $headers['x-amz-checksum-crc32c'][0] ?? null;

src/Service/S3/src/Result/HeadObjectOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ protected function populateResult(Response $response): void
534534
$this->restore = $headers['x-amz-restore'][0] ?? null;
535535
$this->archiveStatus = $headers['x-amz-archive-status'][0] ?? null;
536536
$this->lastModified = isset($headers['last-modified'][0]) ? new \DateTimeImmutable($headers['last-modified'][0]) : null;
537-
$this->contentLength = $headers['content-length'][0] ?? null;
537+
$this->contentLength = isset($headers['content-length'][0]) ? filter_var($headers['content-length'][0], \FILTER_VALIDATE_INT) : null;
538538
$this->checksumCrc32 = $headers['x-amz-checksum-crc32'][0] ?? null;
539539
$this->checksumCrc32C = $headers['x-amz-checksum-crc32c'][0] ?? null;
540540
$this->checksumSha1 = $headers['x-amz-checksum-sha1'][0] ?? null;

0 commit comments

Comments
 (0)