Bug #69477 [Opn]: ZipArchive::extractTo() truncates path segments ending in .
| From: | cmb@php.net | Date: | Sat, 18 Apr 2015 01:02:11 +0000 |
| Subject: | Bug #69477 [Opn]: ZipArchive::extractTo() truncates path segments ending in . | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192177@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69477&edit=1
ID: 69477
Updated by: cmb@php.net
Reported by: jason at opengeek dot com
Summary: ZipArchive::extractTo() truncates path segments
ending in .
Status: Open
Type: Bug
Package: Zip Related
Operating System: OS X 10.10.3
PHP Version: 5.6.8
Block user comment: N
Private report: N
New Comment:
FWIW: Windows doesn't like trailing dots in folder names, so such
archives would not be portable.
Previous Comments:
------------------------------------------------------------------------
[2015-04-17 19:51:19] elizabeth at modx dot com
Same thing happening on 5.4:
$ php t.php
Opened archive test-archive.zip successfully
test/test.txt
test./test.txt
.test/test.txt
Extract failure: expected file to exist at test-extract/test./text.txt
$ php -v
PHP 5.4.30 (cli) (built: Jun 27 2014 12:05:12)
------------------------------------------------------------------------
[2015-04-17 19:12:13] jason at opengeek dot com
Description:
------------
ZipArchive::extractTo will truncate any path segment which ends in a period. For instance, if I
create a zip file and add the file
path/to./file.txt and then extract that file, it
will be extracted to path//file.txt instead of in the actual expected path.
See the gist provided for a sample script which demonstrates the problem.
Test script:
---------------
https://gist.github.com/opengeek/483d830bf35b60a2ef22
Expected result:
----------------
/usr/local/bin/php /Users/opengeek/repos/test/test-zip.php
Opened archive test-archive.zip successfully
test/test.txt
test./test.txt
.test/test.txt
Process finished with exit code 0
Actual result:
--------------
/usr/local/bin/php /Users/opengeek/repos/test/test-zip.php
Opened archive test-archive.zip successfully
test/test.txt
test./test.txt
.test/test.txt
Extract failure: expected file extracted to test-extract/test./text.txt
Process finished with exit code 0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69477&edit=1