[web-doc] master: Fix diff header skip. Thanks. Closes GH-31

[email protected] (Lucas Azevedo via Nilgün Belma Bugüner) Tue, 11 Jan 2022 01:50:53 +0000
Newsgroups php.doc.web
Message-ID <[email protected]>
Author: Lucas Azevedo (lhsazevedo)
Committer: Nilgün Belma Bugüner (nilgun)
Date: 2022-01-11T04:49:36+03:00

Commit: https://github.com/php/web-doc/commit/970adac4e9ec4d17393647ca1548d4c10287f70f
Raw diff: https://github.com/php/web-doc/commit/970adac4e9ec4d17393647ca1548d4c10287f70f.diff

Fix diff header skip. Thanks. Closes GH-31

Changed paths:
  M  include/lib_revcheck.inc.php


Diff:

diff --git a/include/lib_revcheck.inc.php b/include/lib_revcheck.inc.php
index 8457639..02f34d8 100644
--- a/include/lib_revcheck.inc.php
+++ b/include/lib_revcheck.inc.php
@@ -279,7 +279,10 @@ function showdiff ()
 
         echo "<div style='padding: 12px;'>$gitfile</div>";
 
-        foreach (array_slice($lines, 4) as $line) {
+        // Count how many lines to skip diff header
+        $diffStartLine = substr_count($raw, "\n", 0, strpos($raw, " @@"));
+
+        foreach (array_slice($lines, $diffStartLine) as $line) {
             $fc = substr( $line , 0 , 1 );
 
             echo "<div style='display: flex;'>";