Using stream_get_contents in file_get_contents implementation + close handle
This commit is contained in:
parent
ff16e3dbff
commit
8991272269
|
@ -112,24 +112,19 @@ class Encryption extends Wrapper {
|
|||
*/
|
||||
public function file_get_contents($path) {
|
||||
|
||||
$data = null;
|
||||
$encryptionModule = $this->getEncryptionModule($path);
|
||||
|
||||
if ($encryptionModule) {
|
||||
|
||||
$handle = $this->fopen($path, 'r');
|
||||
|
||||
if (is_resource($handle)) {
|
||||
while (!feof($handle)) {
|
||||
$data .= fread($handle, $this->util->getBlockSize());
|
||||
$handle = $this->fopen($path, "r");
|
||||
if (!$handle) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$data = $this->storage->file_get_contents($path);
|
||||
}
|
||||
|
||||
$data = stream_get_contents($handle);
|
||||
fclose($handle);
|
||||
return $data;
|
||||
}
|
||||
return $this->storage->file_get_contents($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* see http://php.net/manual/en/function.file_put_contents.php
|
||||
|
|
Loading…
Reference in New Issue