Go to the FreeLists Home Page Home Signup Help Login
 



[dokuwiki] || [Date Prev] [09-2007 Date Index] [Date Next] || [Thread Prev] [09-2007 Thread Index] [Thread Next]

[dokuwiki] Blog plugin vs PHP 5.2.4

  • From: "Ilya S. Lebedev" <ilya@xxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sat, 8 Sep 2007 05:41:05 +0400
Hello,

I've upgraded PHP to 5.2.4-r2 release and run into the troubles with
Blog plugin (debug took about 10 hours...) - DokuWiki crashed
immediately, when i access any page. No errors were shown, nothing
happened, except some "segmentation fault" messages in the logs...

The bug is in the _uniqueKey method, calling itself recursively, when
there's no need in it at all.
Maybe this looks like PHP bug, but i suggest to fix it in this way:

  /**
   * Non-recursive function to check whether an array key is unique
   */
  function _uniqueKey($key, &$result){
    // increase numeric keys by one
    if (is_numeric($key)){
      while (array_key_exists($key, $result)) $key++;
      return $key;
    // append a number to literal keys
    } else {
      $num=0;
      while (array_key_exists($testkey, $result)) $testkey = $key.($num++ > 0 ? 
$num : '');
      return $testkey;
    }


-- 
Best regards,
 Ilya                          mailto:ilya@xxxxxxxxxxx

-- 
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.