You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Symfony/Component/Filesystem/Filesystem.php
+33-45Lines changed: 33 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -50,13 +50,13 @@ public function copy(string $originFile, string $targetFile, bool $overwriteNewe
50
50
51
51
if ($doCopy) {
52
52
// https://bugs.php.net/64634
53
-
if (false === $source = @fopen($originFile, 'r')) {
54
-
thrownewIOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
53
+
if (!$source = self::box('fopen', $originFile, 'r')) {
54
+
thrownewIOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
55
55
}
56
56
57
57
// Stream context created to allow files overwrite when using FTP stream wrapper - disabled by default
thrownewIOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
thrownewIOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing: ', $originFile, $targetFile).self::$lastError, 0, null, $originFile);
if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
76
76
thrownewIOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
@@ -93,14 +93,8 @@ public function mkdir($dirs, int $mode = 0777)
93
93
continue;
94
94
}
95
95
96
-
if (!self::box('mkdir', $dir, $mode, true)) {
97
-
if (!is_dir($dir)) {
98
-
// The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one
99
-
if (self::$lastError) {
100
-
thrownewIOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
101
-
}
102
-
thrownewIOException(sprintf('Failed to create "%s".', $dir), 0, null, $dir);
103
-
}
96
+
if (!self::box('mkdir', $dir, $mode, true) && !is_dir($dir)) {
97
+
thrownewIOException(sprintf('Failed to create "%s": ', $dir).self::$lastError, 0, null, $dir);
104
98
}
105
99
}
106
100
}
@@ -141,9 +135,8 @@ public function exists($files)
thrownewIOException(sprintf('Unable to create "%s" link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
404
397
}
405
398
}
406
-
thrownewIOException(sprintf('Failed to create "%s" link from "%s" to "%s".', $linkType, $origin, $target), 0, null, $target);
399
+
thrownewIOException(sprintf('Failed to create "%s" link from "%s" to "%s": ', $linkType, $origin, $target).self::$lastError, 0, null, $target);
407
400
}
408
401
409
402
/**
@@ -625,18 +618,16 @@ public function tempnam(string $dir, string $prefix/*, string $suffix = ''*/)
625
618
626
619
// If no scheme or scheme is "file" or "gs" (Google Cloud) create temp file in local filesystem
0 commit comments