UnifiedArchive
UnifiedArchive copied to clipboard
Cannot access phar file entry '/' in archive 'myfile.tgz'
Describe the bug
When trying to extract a .tgz file with UnifiedArchive it reports the following error message: In Tar.php line 369: "Cannot access phar file entry '/' in archive 'myfile.tgz'"
Doing the same with CLI commands gunzip myfile.tgz & tar xf myfile.tar works fine.
Configuration
- OS: linux debian 9.3
- Version of library: 0.1.2
- Satisfied Composer dependencies (selection) "php": "^7.0", "ext-phar": "", "ext-zip": "", "ext-zlib": "*", "pear/archive_tar": "~1.4.3", "wapmorgan/unified-archive": "^0.1"
tar -tvf myfile.tar shows this (shortened list): drwxr-xr-x web/users 0 2019-01-11 02:10 ./ -rw-r--r-- web/users 15254 2019-01-11 02:10 ./myfile.xml
To Reproduce
$archive = UnifiedArchive::open($absoluteArchiveFilePath); $numberOfFiles = $archive->extractFiles($absoluteTargetDirPath);
Expected behavior
Contents of .tgz file should be extracted to the target directory.
Can you attach this archive?
UnifiedArchive seems to have trouble with the entry ./ in the tar file. The file myfile.tgz which causes the error message when trying to extract it can be created as follows: tmp# ls myfile.xml
tmp# tar -cvf myfile.tar . ./ tar: ./myfile.tar: file is the archive; not dumped ./myfile.xml
tmp# tar -tvf myfile.tar ./ ./myfile.xml
tmp# gzip myfile.tar tmp# mv myfile.tar.gz myfile.tgz
Please find attached a file that was created in this way. As GitHub does not support that file type, I had to zip it in addition. myfile.tgz.zip
Ok, will see in few hours.
This is phar extension related problem: https://bugs.php.net/bug.php?id=71966 Reported this case, will wait for response.