Do not try to close the same resource multiple times

This commit is contained in:
Joas Schilling 2014-08-25 15:31:43 +02:00
parent adca48aa93
commit 989da69cff
1 changed files with 6 additions and 1 deletions

View File

@ -670,7 +670,12 @@ class View {
$source = fopen($tmpFile, 'r');
if ($source) {
$this->file_put_contents($path, $source);
fclose($source);
// $this->file_put_contents() might have already closed
// the resource, so we check it, before trying to close it
// to avoid messages in the error log.
if (is_resource($source)) {
fclose($source);
}
unlink($tmpFile);
return true;
} else {