Permalink
Browse files

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: -
  • Loading branch information...
2 parents fccf904 + 4350d11 commit 22edcd97087a74db32e56c60cf02cf02dd9cc33f @fabpot fabpot committed Jul 9, 2012
Showing with 4 additions and 9 deletions.
  1. +4 −9 SplFileInfo.php
View
@@ -62,14 +62,9 @@ public function getRelativePathname()
*/
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();
}
}

0 comments on commit 22edcd9

Please sign in to comment.