flysystem-aws-s3-v3 icon indicating copy to clipboard operation
flysystem-aws-s3-v3 copied to clipboard

Fstat returns false with 1.0.26 version

Open zazoomauro opened this issue 4 years ago • 3 comments

I have a piece of code like this:

$resource = $this->storage->readStream((string)$path);
            if (is_resource($resource)) {
                $resourceData = stream_get_contents($resource);
                $resourceProperties = fstat($resource);
...

With flysystem-aws-s3-v3 1.0.25 fstat returns an array with size

If I upgrade to 1.0.26 fstat return false instead...

My configuration:

flysystem:
  storages:
    default.storage:
      adapter: 'custom.awss3adapter'

And my custom awss3adapter

use Aws\S3\MultipartUploader;
use Aws\S3\S3Client;
use Exception;
use League\Flysystem\AdapterInterface;
use League\Flysystem\AwsS3v3\AwsS3Adapter as BaseAwsS3Adapter;

final class AwsAdapter extends BaseAwsS3Adapter
{
    public const DEFAULT_CONCURRENCY = 10;
    public const DEFAULT_MULTIPART_THRESHOLD = 209715200;
    public const DEFAULT_PART_SIZE = 1073741824;

    public function __construct(S3Client $client, $bucket, $prefix = '', array $options = [])
    {
        parent::__construct($client, $bucket, $prefix, $options);
    }
}

zazoomauro avatar Dec 01 '20 07:12 zazoomauro

After some investigation the problem is there:

if ($stream) {
  $options['@http']['stream'] = true;
}

This piece was added on 1.0.26 https://github.com/thephpleague/flysystem-aws-s3-v3/commit/9aff157a3ae4bb5df93728f940737263ba6108d7

zazoomauro avatar Dec 01 '20 07:12 zazoomauro

I can confirm the breaking of the fstat and by removing the line stream = true line it works again.

rarothedude avatar Dec 09 '20 11:12 rarothedude

@rarothedude any update on that?

zazoomauro avatar Dec 15 '20 10:12 zazoomauro