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

Built from https://develop.svn.wordpress.org/trunk@42028


git-svn-id: http://core.svn.wordpress.org/trunk@41862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2017-10-26 12:52:53 +00:00
parent 4550ef5b2c
commit c6fd6b0374
2 changed files with 5 additions and 3 deletions

View File

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

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta4-42027'; $wp_version = '4.9-beta4-42028';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.