Fix bad usage of "for" loop

This commit is contained in:
Laurent Destailleur 2018-05-30 11:16:06 +02:00
parent ee83b9a7b2
commit a6e323fae8

View File

@ -1,11 +1,11 @@
<?php <?php
/* Copyright (C) 2016 Jean-François Ferry <hello@librethic.io> /* Copyright (C) 2016 Jean-François Ferry <hello@librethic.io>
* *
* A class containing a diff implementation * A class containing a diff implementation
* *
* Created by Stephen Morley - http://stephenmorley.org/ - and released under the * Created by Stephen Morley - http://stephenmorley.org/ - and released under the
* terms of the CC0 1.0 Universal legal code: * terms of the CC0 1.0 Universal legal code:
* *
* http://creativecommons.org/publicdomain/zero/1.0/legalcode * http://creativecommons.org/publicdomain/zero/1.0/legalcode
*/ */
@ -80,9 +80,9 @@ class Diff
$diff[] = array_pop($partialDiff); $diff[] = array_pop($partialDiff);
} }
for ($index = $end1 + 1; $end2 = ($compareCharacters ? strlen($sequence1) : count($sequence1));
$index < ($compareCharacters ? strlen($sequence1) : count($sequence1)); for ($index = $end1 + 1; $index < $end2; $index++)
$index++) { {
$diff[] = array($sequence1[$index], self::UNMODIFIED); $diff[] = array($sequence1[$index], self::UNMODIFIED);
} }
@ -382,7 +382,7 @@ class Diff
* $index - the current index, passes by reference * $index - the current index, passes by reference
* $type - the type of line * $type - the type of line
*/ */
private static function getCellContent($diff, $indentation, $separator, &$index, $type) private static function getCellContent($diff, $indentation, $separator, &$index, $type)
{ {
// initialise the HTML // initialise the HTML
$html = ''; $html = '';