User tests: Successful: Unsuccessful:
Pull Request resolves #48384.
Currently, there is error when extract zip file in template manager as described at #48384. This PR fixes that error. The PR also improve quality of the existing code and added necessary Path::check when it is needed to avoid path traversal (both from the path of the archive file and also path of the extracted files)
There is error as described at #48384
No error anymore, zip file is extracted properly. If there is existing file with the file in the zip file, you will get error messages such as "Some files with the same name already exist." and "Failed to extract the archive file." , this is expected (and existing behavior, before this PR)
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Administration com_templates |
I have tested this item ✅ successfully on a017d12
I've successfully reproduced the issue and tested the fix as described.
In addition, I have successfully tested that when a file which shall be extracted already exists - this can be easily tested by just trying to extract the zip file a 2nd time - then the extraction fails with error alerts "Some files with the same name already exist." and "Failed to extract the archive file.".
@joomdonation Could you add that to the testing instructions so other testers will test that, too? Thanks in advance.
I have tested this item ✅ successfully on a017d12
I've successfully reproduced the issue and tested the fix as described.
In addition, I have successfully tested that when a file which shall be extracted already exists - this can be easily tested by just trying to extract the zip file a 2nd time - then the extraction fails with error alerts "Some files with the same name already exist." and "Failed to extract the archive file.", and nothing is extracted from that archive, also no other files.
@joomdonation Could you add that to the testing instructions so other testers will test that, too? Thanks in advance.
Could you add that to the testing instructions so other testers will test that, too
@richard67 This is existing behavior and not being changed by this PR, so I do not mention it in the testing instructions.
Could you add that to the testing instructions so other testers will test that, too
@richard67 This is existing behavior and not being changed by this PR, so I do not mention it in the testing instructions.
@joomdonation Yes, but you have fixed that, too. Before it would have failed, too, just it would not be testable because of the first error. But now with your PR it works. So I thought it could be worth to be mentioned.
Anyway, I am ok with it.
P.S.: In addition, I have also tested that trying to upload a crafted Zip file which contains a file with a relative path "../../escaped.txt" (path traversal) is not possible (exception thrown by Path::check).
I have tested this item ✅ successfully on a017d12
tested with a zip file containing files and folders
I have tested this item ✅ successfully on a017d12
tested with a zip file containing files and folders
| Status | Pending | ⇒ | Ready to Commit |
| Labels |
Added:
bug
PR-5.4-dev
|
||
RTC
RTC
what is the expected behaviour when you try to upload a zip file with php files inside it
what is the expected behaviour when you try to upload a zip file with php files inside it
@brianteeman Currently it shows red alert messages "No file was found." and "Failed to upload file.". That can be improved for sure, but right now that's the expected behavior.
@joomdonation Thank you for your speedy fix 👍 and I am wondering that I get success and error message:

Tested with JBT, PHP 8.5 in creating simplest ZIP with one image:
cd images
zip ../media/templates/site/cassiopeia/images/test.zip powered_by.png
zipinfo ../media/templates/site/cassiopeia/images/test.zip powered_by.png
-rw-r--r-- 3.0 unx 3197 bx stor 26-Sep-08 17:25 powered_by.png
'File Content Preview' lists the one image file name.
'Extract Here' extracts the image and I am getting success message Archive file extracted., but additional an error message Archive file not found.?
@muhme From the code, I could not guess how you get both success and error message like that. Can you test it again with a different zip file, maybe with a fresh Joomla 5.4 installation?
It was the second ZIP file and it was fresh 5.4-dev branch installation. Used Patch Tester. I will try full installation from PR's Download and test ZIP with multiple files ...
Can you upload the zip file which you are using for testing so that I can try to test it myself with your file, too ?
@joomdonation Same result (success + error message) with PR's full packages installation, different ZIP containing multiple images, using 7-Zip instead Apple-compiled zip, Joomla debug disabled or using Safari instead of Firefox. No Joomla or PHP log entries.
I tried with your file (which is a very simple zip file) but for some reasons, I could not replicate the errors you are having here, so strange. Is your test site public accessible? If Yes, can you give me access so that I can try it directly on your test site. Will send you a message on Mattermost.
| Status | Ready to Commit | ⇒ | Pending |
Set back to Pending as there is an error message in sub-folders
Set back to Pending as there is an error message in sub-folders
I just tried with your zip. Uploading it into various different folders and then extracting it - no problem here
@joomdonation how do i replicate the problem?
@brianteeman Please upload the zip file to media/templates/site/cassiopeia , then select that file and extract it from there

I have tested this item ✅ successfully on 3641e47
I have verified the additional error reported by @muhme and confirm that the latest addition to this PR fixes it
I have tested this item ✅ successfully on 3641e47
I have verified the additional error reported by @muhme and confirm that the latest addition to this PR fixes it
I have tested this item ✅ successfully on 3641e47
In addition to my previous test, I've successfully verified the issue found by @muhme and tested the fix.
I have tested this item ✅ successfully on 3641e47
In addition to my previous test, I've successfully verified the issue found by @muhme and tested the fix.
| Status | Pending | ⇒ | Ready to Commit |
RTC
RTC
| Labels |
Added:
RTC
|
||
✅ Final test before merge with JBT
templates and also in media foldertemplates and also in media folder../../../../tmp/hello-world.php fails with exception Joomla\Filesystem\Path::check() - Use of relative paths not permittedSome files with the same name already exist.| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-09-10 11:57:35 |
| Closed_By | ⇒ | muhme |
Thank you very much @joomdonation for your speedy fix. Thanks to @brianteeman and @richard67 for testing multiple times.
Thanks
I have tested this item ✅ successfully on a017d12
I've successfully reproduced the issue and tested the fix as described.
In addition, I have successfully tested that when a file which shall be extracted already exists - this can be easily tested by just trying to extract the zip file a 2nd time - then the extraction fails with error alerts "Some files with the same name already exist." and "Failed to extract the archive file.".
@joomdonation Could you add that to the testing instructions so other testers will test that, too? Thanks in advance.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48386.