Bug #15654: PHP crashes using the zip functions

From: Date: Thu, 21 Feb 2002 05:58:47 +0000
Subject: Bug #15654: PHP crashes using the zip functions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-706@lists.php.net to get a copy of this message
From: leigh@cfgn.net Operating system: Mandrake Linux 8.1 PHP version: 4.1.1 PHP Bug Type: ZZiplib Related Bug description: PHP crashes using the zip functions The zip functions in PHP4.1.1 appears to be causing PHP to crash with a segmentation fault. When using it in my project I get a "document contains no data". I borrowed the script used in a previous bug report. <?php $zip = zip_open("test_zip.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); } ?> [leigh@eden debug]$ php-debug ./test.php X-Powered-By: PHP/4.1.1 Content-type: text/html Ok, entering while.. Segmentation fault (core dumped) The Backtrace: (gdb) bt #0 0x08115b82 in zend_fetch_resource (passed_id=0x81af524, default_id=-1, resource_type_name=0x8155d4c "Zip Directory", found_resource_type=0x0, num_resource_types=1) at zend_list.c:123 #1 0x080f86a3 in zif_zip_read (ht=1, return_value=0x81af4e4, this_ptr=0x0, return_value_used=1) at zip.c:154 #2 0x0812e14a in execute (op_array=0x81ab324) at ./zend_execute.c:1590 #3 0x0810fe90 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:814 #4 0x08065355 in php_execute_script (primary_file=0xbffff790) at main.c:1307 #5 0x08062e4c in main (argc=2, argv=0xbffff834) at cgi_main.c:738 #6 0x4033f5b0 in __libc_start_main () from /lib/libc.so.6 (gdb) The zip was created using the zip.lib.php library used in phpMyAdmin but the zip does work and the error still occurs when a zip is created using the zip command on linux. [leigh@eden debug]$ unzip test_zip.zip Archive: test_zip.zip inflating: install/module_info.php inflating: modules/test.php The zip file I used can be downloaded from: http://www.sitebox.org/test_zip.zip I used zziplib-0.10.27 to compile PHP with zip support. My configure script:'./configure' \ '--disable-static' \ '--enable-debug' \ '--disable-rpath' \ '--enable-pic' \ '--enable-inline-optimization' \ '--prefix=/usr' \ '--with-zlib' \ '--with-config-file-path=/etc' \ '--enable-magic-quotes' \ '--enable-debugger' \ '--enable-track-vars' \ '--enable-safe-mode' \ '--with-regex=system' \ '--with-versioning' \ '--enable-sysvsem' \ '--enable-sysvshm' \ '--with-mod_charset' \ '--enable-force-cgi-redirect' \ '--enable-trans-sid' \ '--with-dbase' \ '--with-filepro' \ '--enable-yp' \ '--enable-ftp' \ '--with-xml' \ '--with-gettext' \ '--with-mysql=/usr' \ '--with-pgsql' \ '--with-ldap' \ '--with-interbase=/opt/interbase' \ '--with-zip=/usr/local' \ "$@" -- Edit bug report at http://bugs.php.net/?id=15654&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15654&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15654&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15654&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15654&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15654&r=support Expected behavior: http://bugs.php.net/fix.php?id=15654&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15654&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15654&r=submittedtwice

« previous php.bugs (#706) next »