Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch '2.1' into 2.2

* 2.1:
  remove validation related headers when needed
  use while loop for iterating
  [Filesystem] copy() is not working when open_basedir is set

Conflicts:
	src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php
  • Loading branch information...
commit 4671c92a53e1606a5006badc72b005e9cd2b71dd 2 parents cbfc826 + c8f0ee4
Fabien Potencier fabpot authored

Showing 1 changed file with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. +13 1 Filesystem.php
14 Filesystem.php
@@ -35,6 +35,10 @@ class Filesystem
35 35 */
36 36 public function copy($originFile, $targetFile, $override = false)
37 37 {
  38 + if (!is_file($originFile)) {
  39 + throw new IOException(sprintf('Failed to copy %s because file not exists', $originFile));
  40 + }
  41 +
38 42 $this->mkdir(dirname($targetFile));
39 43
40 44 if (!$override && is_file($targetFile)) {
@@ -44,7 +48,15 @@ public function copy($originFile, $targetFile, $override = false)
44 48 }
45 49
46 50 if ($doCopy) {
47   - if (true !== @copy($originFile, $targetFile)) {
  51 + // https://bugs.php.net/bug.php?id=64634
  52 + $source = fopen($originFile, 'r');
  53 + $target = fopen($targetFile, 'w+');
  54 + stream_copy_to_stream($source, $target);
  55 + fclose($source);
  56 + fclose($target);
  57 + unset($source, $target);
  58 +
  59 + if (!is_file($targetFile)) {
48 60 throw new IOException(sprintf('Failed to copy %s to %s', $originFile, $targetFile));
49 61 }
50 62 }

0 comments on commit 4671c92

Please sign in to comment.
Something went wrong with that request. Please try again.