Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 22edcd97087a74db32e56c60cf02cf02dd9cc33f 2 parents fccf904 + 4350d11
@fabpot fabpot authored
Showing with 4 additions and 9 deletions.
  1. +4 −9 SplFileInfo.php
View
13 SplFileInfo.php
@@ -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();
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.