diff-match-patch
diff-match-patch copied to clipboard
Fix string comparison
Fix string comparison to use operator ===
as PHP tries numeric comparison whenever possible for operator ==
:
assert('0' == '00');
assert(null == '');
use DiffMatchPatch\Diff;
$dmp = new Diff();
var_dump($dmp->main('1', '00000000000000001', false)->getChanges());
// array(1) {
// [0]=>
// array(2) {
// [0]=>
// int(0)
// [1]=>
// string(1) "1"
// }
// }
Any update on this? We ran into the same or at least a similar issue today. Creating a patch between the values string(1) "0"
and string(1) "1"
hangs infinitely.