External Libraries: Remove usage of each() from the Text_Diff_Engine_native class.

This removes deprecated notices in PHP 7.2 but takes a different approach to the upstream class from Horde, which appears to be buggy.

Props SergeyBiryukov
Fixes #41526


git-svn-id: https://develop.svn.wordpress.org/trunk@42028 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn 2017-10-26 12:51:51 +00:00
parent 54602b9904
commit afa1b06984

View File

@ -190,15 +190,16 @@ class Text_Diff_Engine_native {
}
$matches = $ymatches[$line];
reset($matches);
while (list(, $y) = each($matches)) {
while ($y = current($matches)) {
if (empty($this->in_seq[$y])) {
$k = $this->_lcsPos($y);
assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
break;
}
next($matches);
}
while (list(, $y) = each($matches)) {
while ($y = current($matches)) {
if ($y > $this->seq[$k - 1]) {
assert($y <= $this->seq[$k]);
/* Optimization: this is a common case: next match is
@ -211,6 +212,7 @@ class Text_Diff_Engine_native {
assert($k > 0);
$ymids[$k] = $ymids[$k - 1];
}
next($matches);
}
}
}