|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesphp-5.3-zip_fseeko.patch (last revision 2010-12-21 10:27 UTC by jerome dot auge at anakeen dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-12-21 16:16 UTC] jerome dot auge at anakeen dot com
-Package: *Compression related
+Package: Zip Related
[2010-12-21 16:16 UTC] jerome dot auge at anakeen dot com
[2015-05-18 18:34 UTC] cmb@php.net
-Status: Open
+Status: Feedback
-Assigned To:
+Assigned To: cmb
[2015-05-18 18:34 UTC] cmb@php.net
[2015-05-31 04:22 UTC] php-bugs at lists dot php dot net
[2015-05-31 09:35 UTC] jerome dot auge at anakeen dot com
[2015-05-31 14:44 UTC] cmb@php.net
-Status: No Feedback
+Status: Open
[2015-05-31 21:48 UTC] cmb@php.net
-Status: Assigned
+Status: Verified
-Operating System: Linux, Mac OS X
+Operating System: Linux, Mac OS X (x86)
-PHP Version: 5.3.4
+PHP Version: 5.6.9
-Assigned To: cmb
+Assigned To:
[2015-05-31 21:48 UTC] cmb@php.net
[2021-07-19 13:29 UTC] cmb@php.net
-Status: Verified
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2021-07-19 13:29 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 10:00:02 2025 UTC |
Description: ------------ On 32bit system, you can't generate ZIP files larger than 2GB. I reproduce this with : - PHP 5.3.4 on Mac OS 10.5 i686 Also observed with : - PHP 5.2.4 on Ubuntu 8.04 i686 - PHP 5.3.2 on Ubuntu 10.04 i686 I tested with 3 files of 1GB random data. After adding the 3 files, the $zip- >close() returns the error "Seek error: Invalid argument" and there is no zip output file. After looking into ext/zip, it seems that the problem is in the use of "unsigned long" types instead of the "off_t" type in zip_cdir struct, and the fact that the HAVE_FSEEKO and HAVE_FTELLO are not detected/defined by the ./configure script. On OS X (PHP 5.3.4), if I recompile the ext/zip extension by hand with the patch below (force HAVE_FSEEKO/HAVE_FTELLO and adjust the "unsigned long" to "off_t" in zip_cdir struct), then I can create my ZIP archive larger than 2GB. Test script: --------------- #!/bin/bash # -- Create 3 files of 1GB random data for I in 1 2 3; do dd if=/dev/urandom of=f$I bs=1M count=1024; done # -- Create a 'out.zip' archive containing these 3 files php -r '$zip = new ZipArchive(); $zip->open("out.zip", ZIPARCHIVE::CREATE); $zip->addFile("f1"); $zip->addFile("f2"); $zip->addFile("f3"); $ret = $zip->close(); if( $ret === false ) { print sprintf("Error: %s", $zip->getStatusString()); };' zip -T out.zip if [ $? -ne 0 ]; then echo "ERROR" exit 1 fi echo "OK" exit 0 Expected result: ---------------- A ZIP archive with a size around 3GB that passes the `zip -T' verification. Actual result: -------------- $zip->close() returns false with error "Seek error: Invalid argument", and the ZIP output file is not produced.