FPDI icon indicating copy to clipboard operation
FPDI copied to clipboard

Validate $filename in StreamReader::createByFile()

Open JanSlabon opened this issue 8 years ago • 0 comments

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 avatar Feb 21 '18 15:02 JanSlabon