ZF-12127: Zend Service Amazon S3 does not close file pointer on stream file upload
The putFileStream() method in Zend_Service_Amazon_S3 does not close the file pointer after method execution is complete. This leads to issues if the code thereafter tries to do other file operations like unlink() the file after it has been uploaded. The issue does NOT happen with putFile() as it does not use a file pointer.
The following leads to a 'Permission denied' warning on unlink() - the file/folder permissions were verified tobe correct. $filePath = 'some_file_path/file.txt'; $s3 = new Zend_Sercice_Amazon_S3($accesskey, $secretkey); $s3->putFileStream($filePath, 'some_bucket_name/file.txt', array(Zend_Service_Amazon_S3::S3_ACL_HEADER => Zend_Service_Amazon_S3::S3_ACL_PUBLIC_READ)); //the following line leads to 'permission denied' warning as Zend did not close the file handle after upload to amazon s3 unlink($filePath);