ID: 44055
User updated by: vadim at vadiaz dot com
Reported By: vadim at vadiaz dot com
Status: Bogus
Bug Type: Zip Related
Operating System: Linux x86_64
PHP Version: 5.2.6
Assigned To: pajoye
New Comment:
RedHat, CentOS, Fedora, etc have zip extention in core package, also if
you download source from php.net (current is 5.2.6) you will get it with
unpatched zip extention
Previous Comments:
------------------------------------------------------------------------
[2008-07-29 12:47:11] [EMAIL PROTECTED]
"It is not bogus because zip extention is now part of main package
and bug fix was not released in 5.2.6 :( now I am rebuilding php rpms
for all my distributions :("
It is bogus as it is duplicated. Zip is released both in pecl and with
the core distribution. An update for PECL is planed after 5.3.0-alpha1
or alpha2. This update works for 5.2.x as well. Almost all linux distro
uses PECL as mainstream releases.
Btw, the fix is in CVS already.
------------------------------------------------------------------------
[2008-07-29 10:37:19] vadim at vadiaz dot com
It is not bogus because zip extention is now part of main package
and bug fix was not released in 5.2.6 :(
now I am rebuilding php rpms for all my distributions :(
------------------------------------------------------------------------
[2008-02-05 22:49:43] [EMAIL PROTECTED]
Duplicated, it is already reported in pecl:
http://pecl.php.net/bugs/bug.php?id=12965
no need to duplicate it here.
------------------------------------------------------------------------
[2008-02-05 21:32:10] vadim at vadiaz dot com
Description:
------------
zip extention failed to open zip files with thousands of files in root
directory on 64 bit Linux systems. From strace I seen than fseek get
value close to max_long.
After reviewing code I figured out that it caused by wrong default type
cast in php-5.2.5/ext/zip/lib/zip_open.c:313
fseek(fp, -(cd->size+cd->comment_len+EOCDLEN), SEEK_END);
which should be:
fseek(fp, -((long)(cd->size+cd->comment_len+EOCDLEN)), SEEK_END);
because on 64 bit systems long is 8 byte.
I aaplied following path and rebuild rpms for my CentOS 5 from scratch
which solves the problem
--- php-5.2.5/ext/zip/lib/zip_open.c.seek_error 2008-02-05
22:05:03.000000000 +0200
+++ php-5.2.5/ext/zip/lib/zip_open.c 2008-02-05 23:17:05.000000000
+0200
@@ -313,7 +313,7 @@
/* go to start of cdir and read it entry by entry */
bufp = NULL;
clearerr(fp);
- fseek(fp, -(cd->size+cd->comment_len+EOCDLEN), SEEK_END);
+ fseek(fp, -((long)(cd->size+cd->comment_len+EOCDLEN)),
SEEK_END);
if (ferror(fp) || ((unsigned int)ftell(fp) != cd->offset)) {
/* seek error or offset of cdir wrong */
if (ferror(fp))
Reproduce code:
---------------
<html>
<head>
<title>Test of ZipArchive</title>
</head>
<body>
<?php
ini_set('display_errors','true');
include_once "/home/httpd/includes/general/zip0stream.php";
include "zip0://testSite.zip/f1/tst.php";
?>
</body>
</html>
Expected result:
----------------
<html>
<head>
<title>Test of ZipArchive</title>
</head>
<body>
<center><h1>ZipArchive works Ok</h1></center></body>
</html>
Actual result:
--------------
can not open stream 'zip0://testSite.zip/f1/tst.php'
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44055&edit=1