From: Jeff D. <da...@da...> - 2001-11-14 16:31:08
|
There is a bug in PhpWiki 1.2.x which causes PhpWiki to produce corrupt zip dumps. The bug affects the dbm, dba and flat filesystem backends, and is present both in both releases (1.2.0 and 1.2.1). (It is not present in the current CVS, release-1_2-branch.) The fix: Either: Upgrade to the latest CVS code. Upgrade to release 1.2.2 (which is not yet available, as of this writing) or Manually fix your PhpWiki code as described below: My apologies for all inconvenience. Thanks to Malcom Ryan for finding the bug. ===== To Manually Patch PhpWiki 1.2.0 or 1.2.1: 1. Edit the appropriate backend driver: Backend Driver File ======= ============ DBA lib/dbalib.php DBM lib/dbmlib.php flat file lib/db_filesystem.php 2. Find the function definition for RetrievePage(). (Look for a file which begins "function RetrievePage"...) 3. Within RetrievePage() look for the line which begins: $pagehash = unserialize( (the exact arguments of unserialize depend on the backend.) 4. Immediately after that line add a line which reads: $pagehash['pagename'] = $pagename; That's it. When you're done, the appropriate portion of the file should look like: lib/dbalib.php: // Return hash of page + attributes or default function RetrievePage($dbi, $pagename, $pagestore) { if ($data = dba_fetch($pagename, $dbi[$pagestore])) { // unserialize $data into a hash $pagehash = unserialize(UnPadSerializedData($data)); $pagehash['pagename'] = $pagename; return $pagehash; } else { return -1; } } lib/dbmlib.php: // Return hash of page + attributes or default function RetrievePage($dbi, $pagename, $pagestore) { if ($data = dbmfetch($dbi[$pagestore], $pagename)) { // unserialize $data into a hash $pagehash = unserialize(UnPadSerializedData($data)); $pagehash['pagename'] = $pagename; return $pagehash; } else { return -1; } } lib/db_filesystem.php (Phpwiki-1.2.1): if ($data = fread($fd, filesize($filename))) { // unserialize $data into a hash $pagehash = unserialize($data); $pagehash['pagename'] = $pagename; if (!is_array($pagehash)) ExitWiki(sprintf(gettext("'%s': corrupt file"), htmlspecialchars($filename))); lib/db_filesystem.php (Phpwiki-1.2.0): if ($data = file($filename)) { // unserialize $data into a hash $pagehash = unserialize(join("\n", $data)); $pagehash = unserialize($data); } |