merged branch gajdaw/finder_splfileinfo_fpassthu (PR #4751)
Commits
-------
b4d7a7e
[Component][Finder][SplFileInfo] file_get_contents=>fpassthru
Discussion
----------
[Component][Finder][SplFileInfo] file_get_contents=>fpassthru
Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: https://github.com/symfony/symfony/pull/4335/files#r1016152
Todo: -
License of the code: MIT
Documentation PR: -
This commit is contained in:
commit
5608c0c3ee
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user