ID: 44055 Updated by: [EMAIL PROTECTED] Reported By: vadim at vadiaz dot com -Status: Open +Status: Bogus Bug Type: Zip Related Operating System: Linux x86_64 PHP Version: 5.2.5 -Assigned To: +Assigned To: pajoye New Comment:
Duplicated, it is already reported in pecl: http://pecl.php.net/bugs/bug.php?id=12965 no need to duplicate it here. Previous Comments: ------------------------------------------------------------------------ [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