php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39537 extractTo(dest,file) method doesn't work
Submitted: 2006-11-16 17:55 UTC Modified: 2006-11-19 03:24 UTC
From: hscheidegger at zumbach dot ch Assigned: pajoye (profile)
Status: Not a bug Package: Zip Related
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
 [2006-11-16 17:55 UTC] hscheidegger at zumbach dot ch
Description:
------------
extractTo() method only works when extracting every file from the Zip archive.
Single and multiple file extraction does not work.

Win XP
Apache 2.2.3
PHP latest snap, ApacheModul

CLI doesn't work neither.

Regards, H-P Scheidegger


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-16 18:04 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2006-11-16 18:23 UTC] hscheidegger at zumbach dot ch
use the script from the php documentation found here:
http://ch2.php.net/manual/en/function.ziparchive-extractto.php

<?php
$zip = new ZipArchive;
$res = $zip->open('test_im.zip');
if ($res === TRUE) {
   $zip->extractTo('/my/destination/dir/', array('pear_item.gif', 'testfromfile.php'));
   $zip->close();
   echo 'ok';
} else {
   echo 'failed';
}
?>
 [2006-11-16 18:33 UTC] tony2001@php.net
What is the actual result you get?
 [2006-11-16 21:27 UTC] hscheidegger at zumbach dot ch
When I do:
$zip->extractTo('/my/destination/dir/');
every file in the archive is extracted.

When I do:
$zip->extractTo('/my/destination/dir/', 'pear_item.gif');
no file is extracted and no error message appear.

When I do:
$zip->extractTo('/my/destination/dir/', array('pear_item.gif','testfromfile.php'));
no file is extracted and no error message appear.
 [2006-11-17 18:46 UTC] pajoye@php.net
I cannot reproduce it on windows and unix, using CLI, apache2 , IIS or CGI.

What's the status after the extractTo call? Can you paste it here? do a var_dump($zip); after having called it.

 [2006-11-18 11:33 UTC] hscheidegger at zumbach dot ch
I didn't know that the params of $zip->extractTo() are case sensitive, which is unusual for windows.
Nevertheless I have some cases, where the application hangs and I have to reboot the machine.
Give me some days to check this out.
 [2006-11-19 03:24 UTC] pajoye@php.net
Yes, it is case sensitive. It is in my todo to add a extended extract function. It will use the common flags (like ZIPARCHIVE::FL_NOCASE) or can based on special filters (like regexp or *.jpeg for example).

About your application hanging, it is a separate issue (if any), please open a new bug for it. I closed this one (bogus).
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 00:01:26 2019 UTC