Class used internally by Diff to actually compute the diffs.

The algorithm used here is mostly lifted from the perl module Algorithm::Diff (version 1.06) by Ned Konz, which is available at:

More ideas are taken from:

Some ideas (and a bit of code) are from analyze.c, from GNU diffutils-2.7, which can be found at:

Finally, some ideas (subdivision by NCHUNKS > 2, and some optimizations) are my own.

Line length limits for robustness added by Tim Starling, 2005-08-31 Alternative implementation added by Guy Van den Broeck, 2008-07-30

@author Geoffrey T. Dairiki, Tim Starling, Guy Van den Broeck


Expanded class hierarchy of DiffEngine


core/includes/, line 146
A PHP diff engine for phpwiki. (Taken from phpwiki-1.3.3)


Contains filters are case sensitive
Namesort descending Modifiers Type Description
DiffEngine::$lcs protected property
DiffEngine::$seq protected property
DiffEngine::$xchanged protected property
DiffEngine::$xind protected property
DiffEngine::$xv protected property
DiffEngine::compareSeq private function Find LCS of two sequences.
DiffEngine::diag private function Divide the Largest Common Subsequence (LCS) of the sequences [XOFF, XLIM) and [YOFF, YLIM) into NCHUNKS approximately equally sized segments.
DiffEngine::diff function
DiffEngine::diffLocal private function
DiffEngine::lcsPos private function
DiffEngine::lineHash private function Returns the whole line if it's small enough, or the MD5 hash otherwise
DiffEngine::MAX_XREF_LENGTH constant
DiffEngine::shiftBoundaries private function Adjust inserts/deletes of identical lines to join changes as much as possible.