[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()
{
$level = error_reporting(0);
$content = file_get_contents($this->getRealpath());
error_reporting($level);
if (false === $content) {
$error = error_get_last();
throw new \RuntimeException($error['message']);
}
return $content;
$file = new \SplFileObject($this->getRealpath(), "rb");
ob_start();
$file->fpassthru();
return ob_get_clean();
}
}