Skip to content

Bug: unable to add more than one file to FileCollection constructor #6290

@AnakinA1

Description

@AnakinA1

PHP Version

7.3, 7.4, 8.0, 8.1

CodeIgniter4 Version

4.2.1

CodeIgniter4 Installation Method

Composer (as dependency to an existing project)

Which operating systems have you tested for this bug?

macOS, Linux

Which server did you use?

fpm-fcgi

Database

MariaDB 10.8

What happened?

When I'm trying to create FileCollection object from 2 or more files paths (not directories), passed in the __constructor, only first file is added. Because in FileCollection->add() method uses return $this->addFile($path); instead of $this->addFile($path); that ends the execution of the foreach loop

Steps to Reproduce

$object = new FileCollection(['/path/to/file', '/path/to/other-file']);

Expected Output

An object containing all passed files

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugVerified issues on the current code behavior or pull requests that will fix them

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions