[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:
Ilija Tovilo 2023-04-01 15:44:46 +02:00
parent fced34ee1d
commit ed0b773cb9
No known key found for this signature in database
GPG Key ID: A4F5D403F118200A

View File

@ -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++];
} }