Skip to content

Validate $filename in StreamReader::createByFile() #42

Open
@JanSlabon

Description

@JanSlabon

Actually there's no validation before the parameter is passed to fopen(). This could end in a warning.

We could fix this by something like:

if (!(\file_exists($filename) || \is_readable($filename))) {
    throw new \InvalidArgumentException("File does not exists or is not readable.");
}

But this would break usage with stream-wrappers which do not implement url_stat() completely (without mode(2)).

So implementing this check would be a BC break.

Any needs to "fix" this or is the current E_WARNING enough? Ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions