From: Campo W. <rf...@nl...> - 2002-02-05 10:24:41
|
Hi all, First off, let me tell you I'm having lots of fun with phpWiki since last summer. This is a great tool, and I find myself using it all the time, both at home and at work. However, I think I have hit a bug in the ziplib. When unloading my 1.2.2 wiki (DBA based) to a ZIP file, it creates corrupt zip files. On closer examination, it turns out that some PHP error messages get written to the ZIP verbatim. Here is an example: (page content omitted...)^M <br /> <b>Warning</b>: Variable passed to reset() is not an array or object in <b>/usr/local/cgi/dbmwiki/lib/ziplib.php</b> on line <b>533</b><br /> <br /> <b>Warning</b>: Variable passed to each() is not an array or object in <b>/usr/local/cgi/dbmwiki/lib/ziplib.php</b> on line <b>534</b><br /> PK^C^D^T^@ (header of next file follows...) This happens on 3 out of 296 pages. Needless to say the resulting ZIP can't be correctly read. Looking at these messages I figured it might be caused by empty pages, so I tried this patch, which seems to solve the problem. --- ./ziplib.php_orig Wed Nov 7 21:32:24 2001 +++ ./ziplib.php Tue Feb 5 11:17:12 2002 @@ -529,10 +529,15 @@ $out = MimeContentTypeHeader('application', 'x-phpwiki', $params); $out .= "Content-Transfer-Encoding: quoted-printable\r\n"; $out .= "\r\n"; - - reset($content); - while (list($junk, $line) = each($content)) - $out .= QuotedPrintableEncode(chop($line)) . "\r\n"; + + if (is_array($content)) { + reset($content); + while (list($junk, $line) = each($content)) + $out .= QuotedPrintableEncode(chop($line)) . "\r\n"; + } + elseif (is_string($content)) { + $out .= QuotedPrintableEncode(chop($content)) . "\r\n"; + } return $out; } Note that I'm not a PHP programmer, and I really don't know whether the is_string() part makes any sense here. Regards, -- $_ = "Campo Weijerman [rfc822://nl.ibm.com/]" and tr-[:]/-<@>-d and print; |
From: Jeff D. <da...@da...> - 2002-02-05 18:05:29
|
On Tue, 5 Feb 2002 11:24:13 +0100 "Campo Weijerman" <rf...@nl...> wrote: > When unloading my > 1.2.2 wiki (DBA based) to a ZIP file, it creates corrupt zip files. > On closer examination, it turns out that some PHP error messages get > written to the ZIP verbatim. Yes, that has always been a problem in 1.2.x (PHP warnings corrupting zip output, that is...) Thanks for the report. I've fixed it in CVS, I think. You can get the new version (though your fixes look fine, as is) at: http://cvs.sf.net/cgi-bin/viewcvs.cgi/phpwiki/phpwiki/lib/ziplib.php?rev=1.2.2.5&only_with_tag=release-1_2-branch&content-type=text/vnd.viewcvs-markup |
From: Campo W. <rf...@nl...> - 2002-02-05 21:41:31
|
On Tue, Feb 05, 2002 at 10:05:24AM -0800, Jeff Dairiki wrote: > Yes, that has always been a problem in 1.2.x (PHP warnings corrupting > zip output, that is...) You seem to be implying the underlying problem has been fixed in 1.3? That would be very good. In fact, this particular problem has kept me from upgrading to 1.3 for some time: I didn't understand why, after unloading my pages from the 1.2 wiki and loading them back into 1.3, more than half of my pages were gone. Then I tried migrating using serialized pages. This time all of the pages seemed to be copied, but the meta data was lost. Plus, all of the pages ended up being locked, which is painful. After applying the "emtpy page zipdump fix", I have now successfully migrated to 1.3.2. > Thanks for the report. I've fixed it in CVS, I think. You can get > the new version (though your fixes look fine, as is) at: Well, your look more solid. I'll try them next time I have to migrate a 1.2 wiki to 1.3.2 Thanks, -- $_ = "Campo Weijerman [rfc822://nl.ibm.com/]" and tr-[:]/-<@>-d and print; |
From: Jeff D. <da...@da...> - 2002-02-09 04:05:59
|
Campo Weijerman said: > Then I tried > migrating using serialized pages. This time all of the pages > seemed to be copied, but the meta data was lost. Plus, all of the > pages ended up being locked, which is painful. It was a missing 'break;' in a switch statement. It's fixed now (in CVS). (Sorry for the pain.) |