Skip to content

S3, check if file exists => Error parsing XML: String could not be parsed as XML #3181

@mumhftm

Description

@mumhftm

Describe the bug

Calling Aws\S3\S3Client->doesObjectExistV2()

leads to the exception:
Error parsing response for HeadObject: AWS parsing error: Error parsing XML: String could not be parsed as XML at /aws/aws-sdk-php/src/S3/Parser/S3Parser.php:74

  • Happens since V351.10.
  • Last working version is 351.9.
  • I tested almost all versions between 350.0 up to 356.11

Use no special chars (no whitespace or similar) in filenames of files on S3. Paths are simple, e.g. invoices/2025/506/2025-08-27_506-000030655_invoice.pdf

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

It should just return a boolean, indicating whether or not the file exists on S3.

Current Behavior

It leads to the described exception.
Happens with all files.

Reproduction Steps

  1. Place a file to an S3 bucket
  2. Assign permissions to access the S3 bucket to an EC2 (with Ubuntu)
  3. Install the AWS lib and PHP
  4. Call the doesObjectExistV2()

Possible Solution

I would - obviously - review the changes:
3.351.9...3.351.10

Additional Information/Context

No response

SDK version used

351.10

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

PHP 8.3.6, Ubuntu 24.04.1, EC2, S3 Bucket, Access through assigned IAM role

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions