File tree 1 file changed +11
-0
lines changed
Filter options
src/Symfony/Component/Filesystem
1 file changed +11
-0
lines changed
Original file line number Diff line number Diff line change @@ -318,6 +318,8 @@ private function isReadable(string $filename): bool
318
318
*/
319
319
public function symlink ($ originDir , $ targetDir , $ copyOnWindows = false )
320
320
{
321
+ self ::assertOperationIsAvailable ('symlink ' );
322
+
321
323
if ('\\' === \DIRECTORY_SEPARATOR ) {
322
324
$ originDir = strtr ($ originDir , '/ ' , '\\' );
323
325
$ targetDir = strtr ($ targetDir , '/ ' , '\\' );
@@ -354,6 +356,8 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
354
356
*/
355
357
public function hardlink ($ originFile , $ targetFiles )
356
358
{
359
+ self ::assertOperationIsAvailable ('link ' );
360
+
357
361
if (!$ this ->exists ($ originFile )) {
358
362
throw new FileNotFoundException (null , 0 , null , $ originFile );
359
363
}
@@ -737,6 +741,13 @@ private function getSchemeAndHierarchy(string $filename): array
737
741
return 2 === \count ($ components ) ? [$ components [0 ], $ components [1 ]] : [null , $ components [0 ]];
738
742
}
739
743
744
+ private static function assertOperationIsAvailable (string $ functionName ): void
745
+ {
746
+ if (!\function_exists ($ functionName )) {
747
+ throw new IOException (sprintf ('Unable to perform filesystem operation because the "%s()" function has been disabled. ' , $ functionName ));
748
+ }
749
+ }
750
+
740
751
/**
741
752
* @param mixed ...$args
742
753
*
You can’t perform that action at this time.
0 commit comments