From 464ddeb29d36712b6307b99dad56723b170f833e Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 20 Mar 2026 18:03:58 +0800 Subject: [PATCH] Fix file copy operation to handle identical source and destination paths --- src/StaticPHP/Util/FileSystem.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/StaticPHP/Util/FileSystem.php b/src/StaticPHP/Util/FileSystem.php index 3015b489..144f81eb 100644 --- a/src/StaticPHP/Util/FileSystem.php +++ b/src/StaticPHP/Util/FileSystem.php @@ -142,6 +142,9 @@ class FileSystem logger()->debug("Copying file from {$from} to {$to}"); $dst_path = FileSystem::convertPath($to); $src_path = FileSystem::convertPath($from); + if ($src_path === $dst_path) { + return true; + } if (!copy($src_path, $dst_path)) { throw new FileSystemException('Cannot copy file from ' . $src_path . ' to ' . $dst_path); }