Skip to content

Commit 0211412

Browse files
committed
Merge branch 'feature/2526-xml-report-bug' of https://github.com/jrfnl/PHP_CodeSniffer
2 parents 8a8089a + 3e6d2c8 commit 0211412

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Reports/Xml.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
7575
// add that manually later. We only have it in here to
7676
// properly set the encoding.
7777
$content = $out->flush();
78-
$content = substr($content, (strpos($content, PHP_EOL) + strlen(PHP_EOL)));
78+
if (strpos($content, PHP_EOL) !== false) {
79+
$content = substr($content, (strpos($content, PHP_EOL) + strlen(PHP_EOL)));
80+
} else if (strpos($content, "\n") !== false) {
81+
$content = substr($content, (strpos($content, "\n") + 1));
82+
}
83+
7984
echo $content;
8085

8186
return true;

0 commit comments

Comments
 (0)