note 113489 deleted from ziparchive.extractto by cmb
| From: | cmb@php.net | Date: | Sat, 25 May 2019 12:44:54 +0000 |
| Subject: | note 113489 deleted from ziparchive.extractto by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211119@lists.php.net to get a copy of this message | ||
Note Submitter: jan dot polak at onmyway dot cz
----
Be careful about a adding filenames that start with a slash '/' to your zip archives and
then extracting them by name:
<?php
$zip->addFromString('/file.txt', 'file contents'); // adds file.txt to
archive's root
$zip->extractTo('dir/to/extract/'); // works, creates dir/to/extract/file.txt
$zip->extractTo('dir/to/extract/', '/file.txt'); // works
$zip->extractTo('dir/to/extract/', 'file.txt'); // fails
?>