Bug #69477 [PATCH]: ZipArchive::extractTo() truncates path segments ending in .
| From: | david@moodle.com | Date: | Tue, 19 Jan 2021 18:01:54 +0000 |
| Subject: | Bug #69477 [PATCH]: ZipArchive::extractTo() truncates path segments ending in . | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231656@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
Patch added by: david@moodle.com
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:
The following pull request has been associated:
Patch Name: Fix #69477 ext/zip: Allow extracting to paths with dirs ending with dot
On GitHub: https://github.com/php/php-src/pull/6624
Patch: https://github.com/php/php-src/pull/6624.patch
Previous Comments:
------------------------------------------------------------------------
[2021-01-14 19:00:35] david at moodle dot com
I just commented in #77214 with the explanation of the bug.
------------------------------------------------------------------------
[2018-08-05 04:14:44] carusogabriel@php.net
Related to Bug #74619
------------------------------------------------------------------------
[2015-04-18 01:02:10] cmb@php.net
FWIW: Windows doesn't like trailing dots in folder names, so such
archives would not be portable.
------------------------------------------------------------------------
[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