<!-- Love localstack? Please consider supporting our collective:
👉  https://opencollective.com/localstack/donate -->

# Type of request: This is a ...

[x] bug report

# Detailed description

 have aws s3 localstack in docker-compose declared as:

```
version: "3"

services:
...
 localstack:
    image: localstack/localstack
    environment:
      - SERVICES=s3
      - USE_SSL=false
      - DEBUG=1
      - DATA_DIR=/tmp/localstack/data
    ports:
      - "4572:4572"
      - "4566:4566"
      - "8083:8080"
    networks:
      - mynetwork
```

After build everything works fine. I am able to connect to the image:
```
docker exec -ti my-project_localstack_1 /bin/bash
```

And make a new bucket using command line:
```
awslocal s3 mb s3://my-bucket
```

Initially I was able to put new objects into the bucket from my php app.
But was not able to see/view list of them from php/postman/browser.

I've made some research and found [this][1] solution.
```
awslocal s3 mb s3://my-bucket

awslocal s3api put-bucket-acl --bucket my-bucket --acl public-read
```

Now, I am able to get list of objects by prefix in anonymous mode (no credentials or tokens) in my Chrome browser and using Postman.

But I fail to get `$s3Client->listObjects(...)`. It always returns empty result.

Note: I am still able to execute `$s3Client->putObject(...)`.
And I checked another commands `$s3client->getBucketAcl(...)` and `$s3Client->getObjectUrl(...)`. They work fine. 
What I want to say, connection to the localstack host from php is fine and instance is working and responding fine.

Here is the code on php side that I use to instantiate `$s3Client`:
```
class S3
{
	/** @var \Aws\S3\S3Client  */
	private static $client = null;
	private static function init()  // Lazy S3client initiation
	{
		if (is_null (self::$client)) {
            self::$client = new Aws\S3\S3Client ([
                'region'  => 'us-east-1',
                'version' => '2006-03-01',
                'credentials'   => false,
                'endpoint' => "http://localstack:4572",
                'use_path_style_endpoint' => true,
                'debug' => true
            ]);
		}
	}  
    ...
    public static function list_objects($bucket, array $options)
	{
		self::init();

        return self::$client->listObjects([
            'Bucket'    => "my-bucket",
            'Prefix'    => "year/month/folder/",
            'Delimiter' => $options['delimiter'] ? $options['delimiter'] : '/',
        ]);
	}
    ...
}
```

This method returns `@metadata->effectiveUri` :
```
 array (size=2)
    'instance' => string '0000000040d78e4d00000000084dbdb3' (length=32)
    'data' => 
      array (size=1)
        '@metadata' => 
          array (size=4)
            'statusCode' => int 200
            'effectiveUri' => string 'http://localstack:4572/my-bucket?prefix=year%2Fmonth%2Ffolder%2F&delimiter=%2F&encoding-type=url'
```

If I take this url and run it in **browser** or **postman** or php docker terminal **curl** it returns list of my files. It only returns empty array when I call it though s3Client in php.

I have a feeling that something is wrong with permissions. But since I don't have that much knowledge and experience with aws-s3 service I can't figure that out. And it seem confusing that some "default" permissions allows client to put objects but restrict to read index. And I can read index of objects using browser or curl, but not through the app.

I've asked[ this question](https://stackoverflow.com/questions/62244318/cant-get-list-objects-from-localstack-s3-bucket-using-php-aws-s3client) on SO.

And someone recommended me to downgrade docker image to `localstack/localstack:0.11.0` and that fixed the issue. 

## Expected behavior

Php aws s3client `listObjects` should return list of objects stored in bucket same as it is returned for curl or browser.

## Actual behavior

Empty list returned


try:
        object_size = s3_client.head_object(Bucket=bucket_name, Key=key).get('ContentLength', 0)
    except botocore.exceptions.ClientError:
        object_size = 0
    
    message = get_event_message(
        event_name=event_name,
        bucket_name=bucket_name,
        file_name=key,
        file_size=object_size,
        version_id=version_id
    )
    message = json.dumps(message)
    if notif.get('Queue'):
        sqs_client = aws_stack.connect_to_service('sqs')
        try:
            queue_url = aws_stack.sqs_queue_url_for_arn(notif['Queue'])
            sqs_client.send_message(QueueUrl=queue_url, MessageBody=message)
        except Exception as e:
            LOGGER.warning('Unable to send notification for S3 bucket "%s" to SQS queue "%s": %s' %
                (bucket_name, notif['Queue'], e))
    if notif.get('Topic'):
        sns_client = aws_stack.connect_to_service('sns')
        try:
            sns_client.publish(TopicArn=notif['Topic'], Message=message, Subject='Amazon S3 Notification')
        except Exception:
            LOGGER.warning('Unable to send notification for S3 bucket "%s" to SNS topic "%s".' %
                (bucket_name, notif['Topic']))
    
    lambda_function_config = notif.get('CloudFunction') or notif.get('LambdaFunction')