[Component][Finder][SplFileInfo] file_get_contents=>fpassthru

This commit is contained in:
Włodzimierz Gajda 2012-06-21 17:41:12 +02:00
parent 000d54cd27
commit b4d7a7e8f6

View File

@ -62,14 +62,9 @@ class SplFileInfo extends \SplFileInfo
*/ */
public function getContents() public function getContents()
{ {
$level = error_reporting(0); $file = new \SplFileObject($this->getRealpath(), "rb");
$content = file_get_contents($this->getRealpath()); ob_start();
error_reporting($level); $file->fpassthru();
if (false === $content) { return ob_get_clean();
$error = error_get_last();
throw new \RuntimeException($error['message']);
}
return $content;
} }
} }