From: corentin dot jacquemet at infomaniak dot com
Operating system: Debian10/Alpine
PHP version: 7.4.12
Package: PHAR related
Bug Type: Bug
Bug description:Phar does not decompress properly
Description:
------------
Wget the official mediawiki 1.35.0 from the official website, then try
to uncompressed the archive using Phar.
The last archive of mediawiki-1.35.0 is not uncompressed correctly by
Phar.
Reproduced on php 7.0.33, 7.1.33, 7.2.34, 7.3.24 and 7.4.12, on debian
10 and alpine (official php docker image)
The "widgets" file should be a directory, not a file.
If we use tar command, the archive is uncompressed correctly.
If we uncompressed using tar command, then compress it into a new
archive, Phar is able to uncompressed correctly this new archive.
Test script:
---------------
<?php
// decompress from gz
$p = new PharData('mediawiki-1.35.0.tar.gz');
$p->decompress(); // creates xxx.tar
// unarchive from the tar
$phar = new PharData('mediawiki-1.35.0.tar');
$phar->extractTo('extracted_'.date('Y-m-d-H:i'));
Expected result:
----------------
$ ls -lah
extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets
total 28
drwxr-xr-x 2 root root 4.0K Nov 6 06:48 .
drwxr-xr-x 3 root root 4.0K Nov 6 06:48 ..
-rw-rw-r-- 1 1000 1000 2.3K Sep 25 14:38
LanguageResultWidget.js
-rw-rw-r-- 1 1000 1000 3.6K Sep 25 14:38
LanguageSearchWidget.js
-rw-rw-r-- 1 1000 1000 1.2K Sep 25 14:38
ParamImportWidget.js
-rw-rw-r-- 1 1000 1000 1.0K Sep 25 14:38
ParamSelectWidget.js
-rw-rw-r-- 1 1000 1000 1.7K Sep 25 14:38 ParamWidget.js
$ ls -lhd
extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.ed
itTemplatePage/widgets
drwxr-xr-x 2 root root 4.0K Nov 6 06:48
mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets
Actual result:
--------------
$ ls -lah
extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/
ext.templateDataGenerator.editTemplatePage/widgets
-rw-rw-r-- 1 root root 1.7K Nov 6 06:44
extracted_2020-11-06-06:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets
$ ls -lhd
extracted_2020-11-06-06\:44/mediawiki-1.35.0/extensions/TemplateData/modules/
ext.templateDataGenerator.editTemplatePage/widgets
-rw-rw-r-- 1 root root 1.7K Nov 6 06:44
extracted_2020-11-06-06:44/mediawiki-1.35.0/extensions/TemplateData/modules/ext.templateDataGenerator.editTemplatePage/widgets
--
Edit bug report at https://bugs.php.net/bug.php?id=80326&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80326&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80326&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80326&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80326&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80326&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80326&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80326&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80326&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80326&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80326&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80326&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80326&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80326&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80326&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80326&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80326&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80326&r=mysqlcfg