Warning from dba_insert

Help
ElkhornBob
2006-08-13
2012-10-11
  • ElkhornBob
    ElkhornBob
    2006-08-13

    I've searched the forum for anything on this, but found nothing.

    I'm getting messages from PHP like the one below when making edit changes to a page. Any advice on what I need to do to stop this? (The edits are being saved ok, strangely.)

    Warning: dba_insert(FrontPage,a:3:{s:9:"fromlinks";a:5:{s:21:"PhpWikiAdministration";i:1;s:12:"ReleaseNotes";i:1;s:8:"TestPage";i:1;s:19:"TextFormattingRules";i:1;s:13:"RecentChanges";i:1;}s:7:"tolinks";a:10:{s:11:"WikiWikiWeb";i:1;s:12:"HowToUseWiki";i:1;s:11:"AddingPages";i:1;s:7:"SandBox";i:1;s:14:"RecentVisitors";i:1;s:13:"RecentChanges";i:1;s:11:"MostPopular";i:1;s:12:"ReleaseNotes";i:1;s:21:"PhpWikiAdministration";i:1;s:9:"WeavaTeam";i:1;}s:8:"pagename";s:9:"FrontPage";} ) [function.dba-insert]: Cannot replace in /www/nwfish.info/subdomains/www/phpwiki/lib/dbalib.php on line 126

    Warning:

     
    • ElkhornBob
      ElkhornBob
      2006-08-14

      I found the following fix/hack in a moldy FAQ cached at google. If anyone knows of a more elegant solution, I'd welcome that :)

      A. I had the same problem and I found that by commenting out line 127 in lib/dbalib.php fixed my problems. I'm guessing that the code was developed with warnings off, so when the insert failed (because the key/value pair all ready existed) the replace was called but the warning was not printed. You may be curious if the replace will work when you actually want to insert a new key/value pair. From what I can tell the dba_replace will do an insert automatically if needed. Potentially this problem will exist in other places, I have not grepped all the code.

      if (!dba_insert($pagename, $pagedata, $dbi[$pagestore])) {
      if (!dba_replace($pagename, $pagedata, $dbi[$pagestore])) {
      ExitWiki("Error inserting page '$pagename'");
      }
      }

      Mine now is:

      if (!dba_replace($pagename, $pagedata, $dbi[$pagestore])) {
      ExitWiki("Error inserting page '$pagename'");
      }

      -- Michael Ihde

       
      • Reini Urban
        Reini Urban
        2006-08-14

        Thanks!
        Fixed in cvs and soon a new release will follow.

        I've looked into the 1.3.x code and this seems to be better, though there are still probably related gdbm problems.