Bug 445533

Summary: Zip compressing a php file with name index.php with just the opening php tags will make it not openable in Ark
Product: [Applications] ark Reporter: Richard M <tygalive>
Component: generalAssignee: Elvis Angelaccio <elvis.angelaccio>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, nate, rthomsen6
Priority: NOR    
Version: 21.08.2   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In: 21.12
Attachments: Ark error message
Have attached the zip file. can be extracted in the terminal but cannot be opened with ark

Description Richard M 2021-11-15 14:57:57 UTC
Created attachment 143582 [details]
Ark error message

SUMMARY

Ark fails to open a zip file with a file named index.php inside with just the PHP opening tags or specifically "<?php // Silence is golden" 
At first, thought was a corrupted zip file but was able to successfully decompress it using unzip, create another archive using arch and have it fail to open also.

STEPS TO REPRODUCE
1. Create a PHP file
2. add opening tags "<?php" or "<?php // Silence is golden"
3. close the file and compress using any tool
4. Try to open generated zip file using ark

OBSERVED RESULT
Ark will say the Zip file is not supported or corrupted

EXPECTED RESULT
Open the zip file

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Have attached a screenshot of the ark error message
Comment 1 Albert Astals Cid 2021-11-15 22:10:30 UTC
Can you attach such a zip file?
Comment 2 Richard M 2021-11-16 06:53:39 UTC
Created attachment 143610 [details]
Have attached the zip file. can be extracted in the terminal but cannot be opened with ark
Comment 3 Bug Janitor Service 2021-11-16 09:10:21 UTC
A possibly relevant merge request was started @ https://invent.kde.org/utilities/ark/-/merge_requests/73
Comment 4 Albert Astals Cid 2021-11-29 19:44:03 UTC
Git commit d4467a99ddb90e5cd57ff243f167f02b96b8e1a1 by Albert Astals Cid.
Committed on 29/11/2021 at 19:40.
Pushed by aacid into branch 'release/21.12'.

Fix loading some zip files

In which QMimeType database says they are actually php files because
mimes are hard. So if we get no offers for the mime type based
on the contents try again with the extension one

M  +10   -4    kerfuffle/archive_kerfuffle.cpp
M  +2    -2    kerfuffle/mimetypes.cpp
M  +8    -1    kerfuffle/mimetypes.h

https://invent.kde.org/utilities/ark/commit/d4467a99ddb90e5cd57ff243f167f02b96b8e1a1