From: Bob A. <apt...@cy...> - 2006-10-08 00:57:09
|
Hi, Reini Urban wrote: [...] > Can you send me your ZIP please to rei...@gm... > > I fixed a problem with loadfile and archived version to recreate the old > versions recently in CVS. But a CRC32 problem would be interesting. I ran into the same trouble tonight importing a zip dump from 1.3.10 into a fresh installation of 1.3.12p3 - I have some diagnostic info and a workaround. Hint: the problem is with the CRC32 checksum comparison, not the zip files. First, in order to get better diagnostics, I changed lib/ziplib.php to: 186 function zip_inflate ($data, $crc32, $uncomp_size) 187 { 188 if (function_exists('gzinflate')) { 189 $data = gzinflate($data); 190 if (strlen($data) != $uncomp_size) 191 trigger_error("not enough output from gzinflate", E_USER_ERROR); 192 # if (zip_crc32($data) != $crc32) 193 $zcrc32 = zip_crc32($data); 194 if ($zcrc32 != $crc32) 195 trigger_error("CRC32 mismatch: calculated=$zcrc32, expected=$crc32 ", E_USER_ERROR); 196 return $data; 197 } My zip file upload fails with: lib/ziplib.php:195: Error: CRC32 mismatch: calculated=-337476845, expected=3957490451 Note that 2^32 = 4294967296 and 4294967296 - 337476845 = 3957490451 My guess is there's some problem with signed vs unsigned 32-bit integers, pack/unpack, or something along those lines - once I changed lib/ziplib.php to 186 function zip_inflate ($data, $crc32, $uncomp_size) 187 { 188 if (function_exists('gzinflate')) { 189 $data = gzinflate($data); 190 if (strlen($data) != $uncomp_size) 191 trigger_error("not enough output from gzinflate", E_USER_ERROR); 192 # if (zip_crc32($data) != $crc32) 193 $zcrc32 = zip_crc32($data); 194 195 if ($zcrc32 < 0) { 196 $zcrc32 += 4294967296; 197 } 198 199 if ($zcrc32 != $crc32) 200 trigger_error("CRC32 mismatch: calculated=$zcrc32, expected=$crc32 ", E_USER_ERROR); 201 return $data; 202 } the zip file uploaded and imported just fine. Well, it stopped importing anything past the first version of a page (not what I wanted) but I've been fighting with that particular problem for *years* with phpwiki. I worked around the CRC issue at least. hth, -- Bob |