Prevent supplied resource is not a valid stream resource

This commit is contained in:
Liam Demafelix 2021-05-29 09:29:44 +08:00 committed by GitHub
parent 948bbe8b2f
commit 3d311b985d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -92,6 +92,11 @@ abstract class Wrapper extends WrapperHandler implements File, Directory {
}
public function stream_close() {
if (is_resource($this->source)
return fclose($this->source);
// Silently return true if source is not a resource
return true;
return fclose($this->source);
}