sebastianbergmann / diff

Diff implementation
BSD 3-Clause "New" or "Revised" License
7.58k stars 85 forks source link

Values should be compared strictly when computing LCS. #27

Closed jesseschalken closed 7 years ago

jesseschalken commented 9 years ago
$d = new \SebastianBergmann\Diff\LCS\MemoryEfficientImplementation;

var_dump( $d->calculate( array( '5' ), array( '05' ) ) );

results in:

array(1) {
  [0] =>
  string(1) "5"
}

but it should result in:

array(0) {
}

because '5' and '05' are not the same.

The practical result is that I had a file for which a line containing a single number had zeros added to the start, but the differ reported that there was no difference.

It seems this is just a matter of changing the == that is used when comparing input values to ===.