ID:               48218
 Updated by:       j...@php.net
 Reported By:      mb at smartftp dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Zip Related
-Operating System: Windows Vista
+Operating System: *
-PHP Version:      5.2CVS-2009-05-10 (snap)
+PHP Version:      5.*, 6CVS (2009-05-10)
-Assigned To:      
+Assigned To:      pajoye


Previous Comments:
------------------------------------------------------------------------

[2009-05-10 00:36:24] mb at smartftp dot com

Description:
------------
The ZIPArchive->open fails with error 11 when a zip file is opened that
has just been created using ZIPArchive. 
The test code works as expected when running it under administrative
privileges. However when running it under restricted access privileges
the ZIPArchive->open function is unable to open the file. On the other
side readfile() can successfully open the same file. My guess is that
the ZipArchive->open functions tries to open the file using a mode other
than just read.

Reproduce code:
---------------
<?php

$file = tempnam(sys_get_temp_dir(), 'zip');
print($file . "\n");

$create = new ZipArchive;
if($create->open($file, ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE ))
{       
        for($i=0; $i<10; $i++)
        {
                $bogus = "fjewklfj23klfj23lkfj23l";
                $create->addFromString($i, $bogus);
        }
        
        if(!$create->close())
        {
                print("close failed");
        }
}                                               

$zip = new ZipArchive();
$open = $zip->open($file);
if($open === TRUE)
{
        print("ok\n");  
}
else
{
        print("error ".$open."\n");
        readfile($file);
}

Expected result:
----------------
ok

Actual result:
--------------
error 11.
content of zip file.


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


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

Reply via email to