diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 5665f66ab128..d3640b4cf5a2 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -170,13 +170,13 @@ protected function populateFiles() return; } + $this->files = []; + if (empty($_FILES)) { return; } - $this->files = []; - $files = $this->fixFilesArray($_FILES); foreach ($files as $name => $file) diff --git a/tests/system/HTTP/Files/FileCollectionTest.php b/tests/system/HTTP/Files/FileCollectionTest.php index 6abe8ffb6891..5bb6b1771eaf 100644 --- a/tests/system/HTTP/Files/FileCollectionTest.php +++ b/tests/system/HTTP/Files/FileCollectionTest.php @@ -9,11 +9,11 @@ public function setUp() //-------------------------------------------------------------------- - public function testAllReturnsNullWithNoFiles() + public function testAllReturnsArrayWithNoFiles() { $files = new FileCollection(); - $this->assertNull($files->all()); + $this->assertEquals([], $files->all()); } //--------------------------------------------------------------------