Bug #80887 [Opn]: MIME type is changed for archives created by ZipArchive

From: Date: Tue, 23 Mar 2021 14:15:02 +0000
Subject: Bug #80887 [Opn]: MIME type is changed for archives created by ZipArchive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232934@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80887&edit=1 ID: 80887 Updated by: cmb@php.net Reported by: kolesnikov dot p at hotmail dot com Summary: MIME type is changed for archives created by ZipArchive Status: Open Type: Bug Package: Zip Related Operating System: Linux PHP Version: 8.0.3 Block user comment: N Private report: N New Comment: I wonder if there is really a difference between the created ZIP archives (what might be caused by different libzip versions), or whether there is an issue with finfo. Previous Comments: ------------------------------------------------------------------------ [2021-03-19 00:49:09] kolesnikov dot p at hotmail dot com Last line echo $info->file('test.zip') . PHP_EOL; ------------------------------------------------------------------------ [2021-03-19 00:45:49] kolesnikov dot p at hotmail dot com Description: ------------ In PHP 7 zip archive created with ZipArchive has MIME type 'application/zip'. In PHP 8 MIME type is 'application/octet-stream' Test script: --------------- <?php unlink('test.zip'); $zip = new ZipArchive(); $zip->open('test.zip', ZipArchive::CREATE); $zip->addFromString('test.txt', 'file content goes here'); $zip->close(); $info = new finfo(FILEINFO_MIME_TYPE); echo $info->file('test1.zip') . PHP_EOL; Expected result: ---------------- application/zip Actual result: -------------- PHP7: application/zip PHP8: application/octet-stream ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80887&edit=1

« previous php.bugs (#232934) next »