php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72412 PharData for archive containing "relative current directory" ( ./ )
Submitted: 2016-06-15 13:24 UTC Modified: -
Votes:12
Avg. Score:4.5 ± 0.5
Reproduced:12 of 12 (100.0%)
Same Version:3 (25.0%)
Same OS:6 (50.0%)
From: raphael dot droz at gmail dot com Assigned:
Status: Open Package: PHAR related
PHP Version: 5.6.22 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2016-06-15 13:24 UTC] raphael dot droz at gmail dot com
Description:
------------
When creating a tar archive containing .
Phar seems unable to extract it.
Extracting ./file1 would work, but listing or extracting the whole archive does not seem possible and fail with a Fatal internal error.
This is especially annoying if you don't know in advance the name of the file to extract: in such case the archive is simply unsuitable for Phar.

As seen on IRC, it (july 14th), it does not affect every PHP version.

Maybe related to bug #64884 since some symptoms seem common.

Test script:
---------------
mkdir -p test1;
echo "This is a test file" > test1/file1;
tar czf test1.tar.gz -C test1 .


php -r '$p = new PharData("/tmp/test1.tar.gz"); $p->extractTo("test2");'
cat test2/file1


Expected result:
----------------
This is a test file

Actual result:
--------------
Extraction from phar "/tmp/test1.tar.gz" failed: Cannot extract ".", internal error in Command line code on line 1

# Note that the "test1" directory is created, but empty

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-27 15:15 UTC] nowytmp3 dot com at gmail dot com
same problem, but i have done the follow. change my system to ubuntu 14.04 and now its working. also with 16.04. why i donĀ“t now but my mp3 youtube converter site is now working. you can check this on: http://mp3-youtube-converter.com
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 05:01:26 2019 UTC