[dev] Major flaw in DataTree::getLast() implementation

Jan Schneider jan at horde.org
Thu May 26 05:18:42 PDT 2005


It took me a while to find this out, but it's easy to reproduce: simply 
start a new thread in Agora and return to the forums listing directly 
after that.

DataTree::getLast() assumes that the last object in a tree branch is 
the one with the highest ID. But that's wrong because in add() we 
*first* retrieve a new sequence ID and *then* check if we already have 
a parent object and create it if not (retrieving another, higher 
sequence ID). This logic could probably be changed in add(), but it 
exists since ever, so getLast() won't work with any old DataTree data, 
which is a bad thing IMO.

Any ideas how to proceed?

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the dev mailing list