Bug #13652: ZIP is broken
| From: | sagi at boom dot org dot il | Date: | Fri, 12 Oct 2001 13:53:27 +0000 |
| Subject: | Bug #13652: ZIP is broken | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-67851@lists.php.net to get a copy of this message | ||
From: sagi@boom.org.il
Operating system: Linux
PHP version: 4.0.6
PHP Bug Type: Zlib Related
Bug description: ZIP is broken
Hi,
Seems like the ZIP extension is broken in php4.0.6 and
php4.0.7-rc3. I just compiled the lastest CVS version and it
seems to have the same problem:
(example code, taken from the manual):
[sagi@domino designs]$ uname -a
Linux domino.lan.boom.org.il 2.4.10 #1 Wed Oct 3 10:57:39
IST 2001 i686 unknown
[sagi@domino designs]$ php -v
4.0.8-dev
[sagi@domino designs]$ cat zip.php
<?php
$zip = zip_open("/tmp/temp.zip");
if ($zip) {
echo "Ok, entering while..\n";
while ($zip_entry = zip_read($zip)) {
echo "In while..\n";
echo "Name: " .
zip_entry_name($zip_entry) . "\n";
echo "Actual Filesize: " .
zip_entry_filesize($zip_entry) . "\n";
echo "Compressed Size: " .
zip_entry_compressedsize($zip_entry) . "\n";
echo "Compression Method: " .
zip_entry_compressionmethod($zip_entry) . "\n";
if (zip_entry_open($zip, $zip_entry, "r")) {
echo "File Contents:\n";
$buf = zip_entry_read($zip_entry,
zip_entry_filesize($zip_entry));
echo "$buf\n";
zip_entry_close($zip_entry);
}
echo "\n";
}
zip_close($zip);
}
?>
[sagi@domino designs]$ php zip.php
X-Powered-By: PHP/4.0.8-dev
Content-type: text/html
Ok, entering while..
Segmentation fault
[sagi@domino designs]$
The zip file is ok:
[sagi@domino dododo]$ unzip /tmp/temp.zip
Archive: /tmp/temp.zip
creating: yellowbluesagi/
inflating: yellowbluesagi/header.php
inflating: yellowbluesagi/footer.php
inflating: yellowbluesagi/index.html
--
Backtrace:
(gdb) run zip.php
Starting program: /usr/local/bin/php zip.php
X-Powered-By: PHP/4.0.8-dev
Content-type: text/html
Ok, entering while..
Program received signal SIGSEGV, Segmentation fault.
0x0812b19a in zend_fetch_resource (passed_id=0x81d432c,
default_id=-1, resource_type_name=0x816db5e "Zip Directory",
found_resource_type=0x0, num_resource_types=1) at
zend_list.c:123
123 } else if ((*passed_id)->type !=
IS_RESOURCE) {
(gdb) backtrace
#0 0x0812b19a in zend_fetch_resource (passed_id=0x81d432c,
default_id=-1, resource_type_name=0x816db5e "Zip Directory",
found_resource_type=0x0, num_resource_types=1) at
zend_list.c:123
#1 0x0810fb17 in zif_zip_read (ht=1,
return_value=0x81d42ec, this_ptr=0x0, return_value_used=1)
at zip.c:154
#2 0x081431d7 in execute (op_array=0x81d013c) at
./zend_execute.c:1598
#3 0x081259cc in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at zend.c:814
#4 0x0806a4a5 in php_execute_script
(primary_file=0xbffffa50) at main.c:1310
#5 0x0806809c in main (argc=2, argv=0xbffffaf4) at
cgi_main.c:737
#6 0x400f87c7 in __libc_start_main (main=0x80678b8 <main>,
argc=2, ubp_av=0xbffffaf4, init=0x8065348 <_init>,
fini=0x814b220 <_fini>,
rtld_fini=0x4000db74 <_dl_fini>, stack_end=0xbffffaec) at
../sysdeps/generic/libc-start.c:129
(gdb)
Sagi
--
Edit bug report at: http://bugs.php.net/?id=13652&edit=1