mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
[skip ci] Avoid infinite loop in differ
TBH I don't understand why this can happen here but not in sebastian/diff. I'll have to take a closer look.
This commit is contained in:
parent
fced34ee1d
commit
ed0b773cb9
@ -3982,11 +3982,11 @@ final class Differ
|
|||||||
reset($to);
|
reset($to);
|
||||||
|
|
||||||
foreach ($common as $token) {
|
foreach ($common as $token) {
|
||||||
while (!($this->isEqual)(reset($from), $token)) {
|
while (!empty($from) && !($this->isEqual)(reset($from), $token)) {
|
||||||
$diff[] = [array_shift($from), self::REMOVED, $fromLine++];
|
$diff[] = [array_shift($from), self::REMOVED, $fromLine++];
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!($this->isEqual)($token, reset($to))) {
|
while (!empty($to) && !($this->isEqual)($token, reset($to))) {
|
||||||
$diff[] = [array_shift($to), self::ADDED, $toLine++];
|
$diff[] = [array_shift($to), self::ADDED, $toLine++];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user