I am using the AWS SDK for PHP, version 2.4.7 installed through the composer. After deleting a file from the S3 bucket, the DeleteMarker key in the response object is always empty, even if the file is actually deleted from S3. The documentation states that DeleteMarker must be true if the operation was successful, otherwise it will be false.
My call to delete:
// delete S3 object $result = $s3->deleteObject(array( 'Bucket' => $this->_bucket, 'Key' => $object_key, ));
and the answer is:
Guzzle\Service\Resource\Model Object ( [structure:protected] => [data:protected] => Array ( [DeleteMarker] => [VersionId] => [RequestId] => 2CC3EC60C4294CB5 ) )
If I then do:
// check if was deleted $is_deleted = (bool) $result->get('DeleteMarker');
$ is_deleted is always false. How can it be that there is no value returned against the DeleteMarker key, even if the delete operation was actually successful and the file was deleted from S3?
UPDATE:
If I add a slash to the beginning of my key, I get a false response back, even if the file is still deleted from S3.
The key "path / to / my / image.jpg" leads to the fact that DeleteMarker has an empty value The key "/path/to/my/image.jpg" leads to the fact that DeleteMarker has an empty false
But in both cases, the images are deleted from the S3 bucket.
source share