|  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: -
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
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


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 20:01:27 2020 UTC