Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JanSlabon opened this issue Feb 21, 2018 · 0 comments
Open

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

JanSlabon opened this issue Feb 21, 2018 · 0 comments
Milestone

Comments

@JanSlabon
Copy link
Member

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?

@JanSlabon JanSlabon added this to the v3 milestone Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant