Skip to content

Commit 8038f09

Browse files
author
alpipego
committed
revert unneeded changes
1 parent 77adaac commit 8038f09

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/Search_Replace_Command.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,6 @@ private function log_bits( $search_regex, $old_data, $old_matches, $new ) {
816816
$append_next = false;
817817
$last_old_offset = $last_new_offset = 0;
818818
for ( $i = 0; $i < $match_cnt; $i++ ) {
819-
if ( empty( $old_matches[0][ $i ] ) || empty( $new_matches[0][ $i ] ) ) {
820-
continue;
821-
}
822819
$old_match = $old_matches[0][ $i ][0];
823820
$old_offset = $old_matches[0][ $i ][1];
824821
$new_match = $new_matches[0][ $i ][0];
@@ -842,12 +839,10 @@ private function log_bits( $search_regex, $old_data, $old_matches, $new ) {
842839
$new_after = \cli\safe_substr( substr( $new_data, $new_end_offset ), 0, $this->log_after_context, false /*is_width*/, $encoding );
843840
// To lessen context duplication in output, shorten the after context if it overlaps with the next match.
844841
if ( $i + 1 < $match_cnt && $old_end_offset + strlen( $old_after ) > $old_matches[0][ $i + 1 ][1] ) {
845-
if ( ! empty( $old_matches[0][ $i + 1 ] ) && ! empty( $new_matches[0][ $i + 1 ] ) ) {
846-
$old_after = substr( $old_after, 0, $old_matches[0][ $i + 1 ][1] - $old_end_offset );
847-
$new_after = substr( $new_after, 0, $new_matches[0][ $i + 1 ][1] - $new_end_offset );
848-
$after_shortened = true;
849-
// On the next iteration, will append with no before context.
850-
}
842+
$old_after = substr( $old_after, 0, $old_matches[0][ $i + 1 ][1] - $old_end_offset );
843+
$new_after = substr( $new_after, 0, $new_matches[0][ $i + 1 ][1] - $new_end_offset );
844+
$after_shortened = true;
845+
// On the next iteration, will append with no before context.
851846
}
852847
}
853848

0 commit comments

Comments
 (0)