joomla-framework / filesystem

Joomla Framework Filesystem Package
GNU General Public License v2.0
9 stars 17 forks source link

Copy fails when src and dest are the same #65

Open rdeutz opened 5 months ago

rdeutz commented 5 months ago

Steps to reproduce the issue

Joomla\Filesystem\File::copy(JPATH_SITE . '/README.txt', JPATH_SITE . '/README.txt');

failed

I know that this doesn't makes sense when we boil it down to the statement here. But the original issue was a result of a script, see https://github.com/joomla/joomla-cms/issues/18352

Expected result

I am not sure if this should fail or not, at least when we just go over it, it will not hurt.

Actual result

Error

System information (as much as possible)

latest version of joomla

Additional comments

HLeithner commented 5 months ago

it's the default behavior as the file system so I think it's correct and should not be simply skipped. Won't change it because the operation didn't finished successful.

HLeithner commented 5 months ago

what we can do is to throw an exception for this case so it can be catched and solved by the executing code