Using stream_get_contents in file_get_contents implementation + close handle
This commit is contained in:
parent
ff16e3dbff
commit
8991272269
|
@ -112,23 +112,18 @@ 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 $data;
|
||||
return $this->storage->file_get_contents($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue