From 57f6b15b4d0ccd8cf4d52dfb7e4c1451d3e03a42 Mon Sep 17 00:00:00 2001 From: andreasschacht Date: Fri, 15 Dec 2017 16:24:50 +0100 Subject: [PATCH] Quickfix for Adapter/AwsS3, check if count() call is allowed. (cherry picked from commit ad3aad3) --- src/Gaufrette/Adapter/AwsS3.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Gaufrette/Adapter/AwsS3.php b/src/Gaufrette/Adapter/AwsS3.php index b39feb471..72e3a5988 100644 --- a/src/Gaufrette/Adapter/AwsS3.php +++ b/src/Gaufrette/Adapter/AwsS3.php @@ -270,8 +270,13 @@ public function isDirectory($key) 'Prefix' => rtrim($this->computePath($key), '/').'/', 'MaxKeys' => 1, ]); + if (isset($result['Contents'])) { + if (is_array($result['Contents']) || $result['Contents'] instanceof \Countable) { + return count($result['Contents']) > 0; + } + } - return count($result['Contents']) > 0; + return false; } /**