Bug #77978 [PATCH]: Dirname ending in colon unzips to wrong dir
| From: | ctrujillopineda@gmail.com | Date: | Sun, 20 Oct 2019 11:22:43 +0000 |
| Subject: | Bug #77978 [PATCH]: Dirname ending in colon unzips to wrong dir | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223318@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77978&edit=1
ID: 77978
Patch added by: ctrujillopineda@gmail.com
Reported by: lars at larsegon dot se
Summary: Dirname ending in colon unzips to wrong dir
Status: Open
Type: Bug
Package: Zip Related
Operating System: Linux
PHP Version: 7.3.5
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: Fixed bug #77978
On GitHub: https://github.com/php/php-src/pull/4835
Patch: https://github.com/php/php-src/pull/4835.patch
Previous Comments:
------------------------------------------------------------------------
[2019-05-25 01:34:31] konstantin dot kuklin at gmail dot com
The following pull request has been associated:
Patch Name: Fixed bug #77978
On GitHub: https://github.com/php/php-src/pull/4160
Patch: https://github.com/php/php-src/pull/4160.patch
------------------------------------------------------------------------
[2019-05-07 08:08:57] lars at larsegon dot se
Description:
------------
If a directory name in a path for a file in zip archive ends with a colon (:) the file will be
extracted to the root dir instead of to its original directory.
Test script:
---------------
<?php
$file = tempnam("/tmp", "ziptest");
$target = tempnam("/tmp", "ziptest");
unlink($target);
mkdir($target);
$zip = new ZipArchive;
$zip->open($file);
$zip->addFromString("dir/test:/filename.txt", "contents");
$zip->addFromString("dir/test:a/filename.txt", "contents");
$zip->addFromString("dir/test/filename.txt", "contents");
$zip->close();
$zip->open($file);
$zip->extractTo($target, "dir/test:/filename.txt");
$zip->extractTo($target, "dir/test:a/filename.txt");
$zip->extractTo($target, "dir/test/filename.txt");
$zip->close();
unlink($file);
Expected result:
----------------
Expected behavior would be that the three files were extracted to the following paths:
/tmp/ziptest/dir/test:/filename.txt
/tmp/ziptest/dir/test:a/filename.txt
/tmp/ziptest/dir/test/filename.txt
Actual result:
--------------
If you run the test script, three files will be extracted to the following paths:
/tmp/ziptest/filename.txt
/tmp/ziptest/dir/test:a/filename.txt
/tmp/ziptest/dir/test/filename.txt
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77978&edit=1