Edit report at http://bugs.php.net/bug.php?id=53893&edit=1

 ID:                 53893
 Updated by:         paj...@php.net
 Reported by:        schmale at froglogic dot com
 Summary:            Wrong return value for ZipArchive::extractTo()
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Zip Related
 Operating System:   Linux
 PHP Version:        5.3.5
-Assigned To:        
+Assigned To:        pajoye
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2011-02-07 17:20:20] paj...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=308107
Log: - Fixed bug #53893 (Wrong return value for ZipArchive::extractTo())

------------------------------------------------------------------------
[2011-02-01 08:57:39] schmale at froglogic dot com

No, it's just an arbitrary zip file. Not empty, of course. In my case,
it was a zip file of approx. 50kb size.



If I deleted the existing directory, the zip file was extracted
perfectly. However, extracting the zip file into a directory with no
write privileges did nothing at all. This is desired behaviour, of
course, if it wasn't for the return value: The ZipArchive::extractTo's
return value was TRUE either way, which lead to some confusion.

------------------------------------------------------------------------
[2011-01-31 21:36:11] fel...@php.net

Hello, I've a doubt about the test case. $zipPath points to an empty zip
file?

------------------------------------------------------------------------
[2011-01-31 17:49:03] schmale at froglogic dot com

Description:
------------
PHP version (as given in phpinfo()): PHP Version 5.3.3-1ubuntu9.3



Zip-related information:

Zip     enabled

Extension Version       $Id: php_zip.c 300470 2010-06-15 18:48:33Z pajoye $

Zip version     1.9.1

Libzip version  0.9.0 

Test script:
---------------
function testReturnValue() {

        $extractToPath = "/home/user/testDir"; /* existing dir with NO
write privileges */

        $zipPath = "path/to/zipFile"; // has to be valid zip file



        $zip = new ZipArchive();

        $open = $zip->open($zipPath);

        if ($open === true) {

           $extracting = $zip->extractTo($extractToPath);

           $zip->close();

           return $extracting;

        } else {

           return false;

        }

}

Expected result:
----------------
Return value of testReturnValue() should be FALSE, as long as the php
user has no write access to the directory into which we extract the zip
(because if that's the case, nothing will happen).

Actual result:
--------------
Return value is TRUE, even if no extracting happened due to lacking
privileges.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53893&edit=1

Reply via email to