1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01: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:
Ilija Tovilo
2023-04-01 15:44:46 +02:00
parent fced34ee1d
commit ed0b773cb9

View File

@@ -3982,11 +3982,11 @@ final class Differ
reset($to);
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++];
}
while (!($this->isEqual)($token, reset($to))) {
while (!empty($to) && !($this->isEqual)($token, reset($to))) {
$diff[] = [array_shift($to), self::ADDED, $toLine++];
}