From:             mb at smartftp dot com
Operating system: Windows Vista
PHP version:      5.2CVS-2009-05-10 (snap)
PHP Bug Type:     Zip Related
Bug description:  ZipArchive->open fails under some circumstances

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 bug report at http://bugs.php.net/?id=48218&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=48218&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=48218&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=48218&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=48218&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48218&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=48218&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=48218&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=48218&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=48218&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=48218&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=48218&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=48218&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=48218&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=48218&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48218&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48218&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=48218&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=48218&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=48218&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=48218&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=48218&r=mysqlcfg

Reply via email to